library(dplyr)
library(lavaan)
library(DiagrammeR)
library(ggplot2)
library(tidyr)
source("functions/table_funcs.R")
# For saving SEM diagrams:
library(purrr)
library(DiagrammeRsvg)
library(rsvg)
library(png)
library(grid)
library(ggpubr)
combined=read.csv("data/monthly_averages/monthly_data_compiled_regions.csv",stringsAsFactors = F)
cnames=read.csv("analysis/column_names_region_monthly.csv", stringsAsFactors = F)
dsub=filter(combined, Year>=1995) %>% arrange(Region,Year,Month)
focaldata=dsub[,cnames$Datacolumn]
fvars=cnames$Shortname
colnames(focaldata)=fvars
regions=unique(focaldata$region)
regionorder=c("Far West","West","North","South")
focaldata=focaldata%>%
mutate(decyear=year+(month-1)/12)
focaldata = focaldata %>%
mutate(tzoop=hcope+clad+mysid+pcope+rotif_m,
tzoop_e=hcope_e+clad_e+mysid_e+pcope_e+rotif_e,
hzoop=hcope+clad+rotif_m,
hzoop_e=hcope_e+clad_e+rotif_e,
pzoop=mysid+pcope,
pzoop_e=mysid_e+pcope_e,
turbid=-secchi)
fvars=c(fvars,"tzoop","tzoop_e",
"hzoop","hzoop_e",
"pzoop","pzoop_e","turbid")
cnames=rbind(cnames,data.frame(Longname=NA,Shortname=c("tzoop","tzoop_e",
"hzoop","hzoop_e",
"pzoop","pzoop_e","turbid"),
Diagramname=c("total zooplankton",
"total zooplankton\nenergy",
"herbivorous\nzooplankton",
"herbivorous\nzooplankton\nenergy",
"predatory\nzooplankton",
"predatory\nzooplankton\nenergy",
"turbidity"),
Datacolumn=NA,Log=c(rep("yes",6),"no"),
Color=c("black","black","#ED7D31","#ED7D31","#7030A0",
"#7030A0","#4472C4")))
#focal variables
varnames=c("temp","flow","turbid","din","chla","hzoop","pzoop","potam","corbic","estfish_bsmt","sside","cent","sbass1_bsmt","marfish_bsmt","hcope","clad","amphi_m","pcope","mysid","rotif_m")
#labels for lagged vars
cnameslag=cnames
cnameslag$Shortname=paste0(cnameslag$Shortname,"_1")
cnameslag$Diagramname=paste(cnameslag$Diagramname,"(t-1)")
cnameslag=rbind(cnames,cnameslag)
#labeld for growth rate
cnamesgr=cnames
cnamesgr$Shortname=paste0(cnamesgr$Shortname,"_gr")
cnamesgr$Diagramname=paste(cnamesgr$Diagramname,"(gr)")
cnameslag=rbind(cnameslag,cnamesgr)
source("analysis/myLavaanPlot.r")
source("analysis/semDiagramFunctions.r")
Log transform, scale.
Within and across regions.
Create set with regional monthly means removed.
#log transform
logvars=fvars[cnames$Log=="yes"]
logtrans=function(x) {
x2=x[which(!is.na(x))]
if(any(x2==0)) {log(x+min(x2[which(x2>0)],na.rm=T))}
else {log(x)}
}
focaldatalog = focaldata %>%
mutate(flow=flow-min(flow,na.rm=T)) %>% #get rid of negative flow values
mutate_at(logvars,logtrans) %>%
group_by(region) %>%
mutate_at(logvars,list("gr"=function(x) {c(NA,diff(x))})) %>%
ungroup()
#scale data
fdr0=focaldatalog
tvars=fvars[-(1:3)]
#scaled within regions
fdr=fdr0 %>%
group_by(region) %>%
#scale
mutate_at(tvars,scale) %>%
#lag
mutate_at(tvars,list("1"=lag,"2"=function(x) {lag(x,2)})) %>%
ungroup() %>%
as.data.frame()
#scaled within regions, remove monthly means
fdr_ds=fdr %>%
group_by(region,month) %>%
mutate_at(tvars,list("mm"=function(x) {mean(x,na.rm = T)})) %>%
mutate_at(tvars,function(x) {x-mean(x,na.rm = T)}) %>%
ungroup() %>%
#lag
group_by(region) %>%
mutate_at(tvars,scale) %>%
mutate_at(tvars,list("1"=lag,"2"=function(x) {lag(x,2)})) %>%
ungroup() %>%
as.data.frame()
#scaled across regions
# fdr1=fdr0 %>%
# #scale
# mutate_at(tvars,scale) %>%
# #lag
# group_by(region) %>%
# mutate_at(tvars,list("1"=lag,"2"=function(x) {lag(x,2)})) %>%
# ungroup() %>%
# as.data.frame()
#scaled across regions, monthly means removed
# fdr1_ds=fdr1 %>%
# group_by(region,month) %>%
# mutate_at(tvars,list("mm"=function(x) {mean(x,na.rm = T)})) %>%
# mutate_at(tvars,function(x) {x-mean(x,na.rm = T)}) %>%
# ungroup() %>%
# #lag
# group_by(region) %>%
# mutate_at(tvars,list("1"=lag,"2"=function(x) {lag(x,2)})) %>%
# ungroup() %>%
# as.data.frame()
Exclude individual zooplankton plankton groups from zooplankton model if rare (95% of values in a region are less than the across site mean, or more than 10% of values in a region are zeros).
sside and cent have no data in FW and W.
marfish and clams excluded if 95% of values in a region are less than the across site mean, though this results in marfish being excluded from W.
FW: exclude clad, mysid, corbic, sside/cent
W: exclude clad, corbic, marfish, sside/cent
N: exclude clad, potam, marfish
S: exclude mysid, potam, marfish
dataavail=focaldata %>%
gather(var, value, 4:length(fvars)) %>%
group_by(var) %>%
mutate(varmean=mean(value, na.rm=T)) %>% ungroup() %>%
group_by(region, var) %>%
summarize(
propmissing=length(which(is.na(value)))/length(value),
propzeros=length(which(value==0))/length(which(!is.na(value))),
exclude=ifelse(quantile(value,probs = 0.95, na.rm = T)<mean(varmean),T,F)) %>%
as.data.frame()
## `summarise()` has grouped output by 'region'. You can override using the
## `.groups` argument.
#these variables should not be used (too many zeros)
filter(dataavail,propzeros>0.1 | exclude) %>% filter(var %in% c("mysid","hcope","pcope","rotif_m","clad"))
## region var propmissing propzeros exclude
## 1 Far West clad 0.141025641 0.72388060 TRUE
## 2 Far West mysid 0.137820513 0.21933086 TRUE
## 3 North clad 0.012820513 0.11363636 FALSE
## 4 South mysid 0.006410256 0.08709677 TRUE
## 5 West clad 0.009615385 0.20064725 FALSE
filter(dataavail,exclude) %>% filter(var %in% c("marfish_bsmt","potam","corbic"))
## region var propmissing propzeros exclude
## 1 Far West corbic 0.1410256 1.0000000 TRUE
## 2 North marfish_bsmt 0.1891026 0.9762846 TRUE
## 3 North potam 0.1378205 0.1486989 TRUE
## 4 South marfish_bsmt 0.1826923 1.0000000 TRUE
## 5 South potam 0.1378205 0.9702602 TRUE
## 6 West corbic 0.1378205 0.8066914 TRUE
## 7 West marfish_bsmt 0.1666667 0.2192308 TRUE
## Note: Using an external vector in selections is ambiguous.
## i Use `all_of(varnames)` instead of `varnames` to silence this message.
## i See <https://tidyselect.r-lib.org/reference/faq-external-vector.html>.
## This message is displayed once per session.
Breakdown of total zooplankton biomass.
## Warning: Removed 272 rows containing missing values (position_stack).
Correlation between biomass and energy.
for(i in 1:length(regions)) {
dtemp=filter(fdr,region==regions[i])
print(regions[i])
print(cor(dtemp$tzoop,dtemp$tzoop_e,use = "p"))
print(cor(dtemp$hzoop,dtemp$hzoop_e,use = "p"))
print(cor(dtemp$pzoop,dtemp$pzoop_e,use = "p"))
}
## [1] "Far West"
## [,1]
## [1,] 0.9941835
## [,1]
## [1,] 0.9945149
## [,1]
## [1,] 0.9996106
## [1] "North"
## [,1]
## [1,] 0.9938912
## [,1]
## [1,] 0.9903659
## [,1]
## [1,] 0.999494
## [1] "South"
## [,1]
## [1,] 0.9955739
## [,1]
## [1,] 0.9952125
## [,1]
## [1,] 0.99925
## [1] "West"
## [,1]
## [1,] 0.9797348
## [,1]
## [1,] 0.9374501
## [,1]
## [1,] 0.9983814
(only sig correlations shown… no correction for multiple comparisons)
## Warning: `expand_scale()` is deprecated; use `expansion()` instead.
## Warning: `expand_scale()` is deprecated; use `expansion()` instead.
## Warning: `expand_scale()` is deprecated; use `expansion()` instead.
## Warning: `expand_scale()` is deprecated; use `expansion()` instead.
## Warning: `expand_scale()` is deprecated; use `expansion()` instead.
## Warning: `expand_scale()` is deprecated; use `expansion()` instead.
Other notes:
Detrended fish indices are NOT correlated in S!
Nitrate and ammonia are positively correlated, max at lag 0 all regions.
Nitrate and dophos are positively correlated, max at lag 0 all regions.
Ammonia and dophos are positively correlated, lag 0 for FW and S, ammonia lags dphos by 3 months in W and N.
Chla nitrate neg correlated, lag 0.
Chla ammonia neg correlated, lag 0.
Chla dophos relationship unclear.
High flow 2-4 month prev = high chla
Hcope lags chla by 1, positive, except FW.
Clad seem to precede chla by 2, positive.
Amphi relationship unclear, prob bc not eating chla in water column.
In N and W, chla lags potam, negative. The opposite in W.
Mysid and hcope postive, lag 0.
In S and W, hcope lags pcope, negative.
modFW='hzoop~hb1*chla_1+hs1*hzoop_1+ht1*pzoop_1+ht2*potam_1+ht3*estfish_bsmt_1+ha1*flow+ha2*temp+ha3*turbid
pzoop~pb1*hzoop_1+ps1*pzoop_1+pt1*potam_1+pt2*estfish_bsmt_1+pa1*flow+pa2*temp+pa3*turbid
estfish_bsmt~fb1*hzoop_1+fb2*pzoop_1+fs1*estfish_bsmt_1+fa1*flow+fa2*temp+fa3*turbid+ft1*marfish_bsmt_1+ft2*sbass1_bsmt_1
hb:=sqrt(hb1^2)
hs:=sqrt(hs1^2)
ht:=sqrt(ht1^2+ht2^2+ht3^2)
ha:=sqrt(ha1^2+ha2^2+ha3^2)
pb:=sqrt(pb1^2)
ps:=sqrt(ps1^2)
pt:=sqrt(pt1^2+pt2^2)
pa:=sqrt(pa1^2+pa2^2+pa3^2)
fb:=sqrt(fb1^2+fb2^2)
fs:=sqrt(fs1^2)
ft:=sqrt(ft1^2+ft2^2)
fa:=sqrt(fa1^2+fa2^2+fa3^2)
'
modW='hzoop~hb1*chla_1+hs1*hzoop_1+ht1*pzoop_1+ht2*potam_1+ht3*estfish_bsmt_1+ha1*flow+ha2*temp+ha3*turbid
pzoop~pb1*chla_1+pb2*hzoop_1+ps1*pzoop_1+pt1*potam_1+pt2*estfish_bsmt_1+pa1*flow+pa2*temp+pa3*turbid
estfish_bsmt~fb1*hzoop_1+fb2*pzoop_1+fs1*estfish_bsmt_1+fa1*flow+fa2*temp+fa3*turbid+ft1*sbass1_bsmt_1
hb:=sqrt(hb1^2)
hs:=sqrt(hs1^2)
ht:=sqrt(ht1^2+ht2^2+ht3^2)
ha:=sqrt(ha1^2+ha2^2+ha3^2)
pb:=sqrt(pb1^2+pb2^2)
ps:=sqrt(ps1^2)
pt:=sqrt(pt1^2+pt2^2)
pa:=sqrt(pa1^2+pa2^2+pa3^2)
fb:=sqrt(fb1^2+fb2^2)
fs:=sqrt(fs1^2)
ft:=sqrt(ft1^2)
fa:=sqrt(fa1^2+fa2^2+fa3^2)
'
modN='hzoop~hb1*chla_1+hs1*hzoop_1+ht1*pzoop_1+ht2*corbic_1+ht3*estfish_bsmt_1+ha1*flow+ha2*temp+ha3*turbid
pzoop~pb1*chla_1+pb2*hzoop_1+ps1*pzoop_1+pt1*corbic_1+pt2*estfish_bsmt_1+pa1*flow+pa2*temp+pa3*turbid
estfish_bsmt~fb1*hzoop_1+fb2*pzoop_1+fs1*estfish_bsmt_1+fa1*flow+fa2*temp+fa3*turbid+ft1*sside_1+ft2*cent_1+ft3*sbass1_bsmt_1
hb:=sqrt(hb1^2)
hs:=sqrt(hs1^2)
ht:=sqrt(ht1^2+ht2^2+ht3^2)
ha:=sqrt(ha1^2+ha2^2+ha3^2)
pb:=sqrt(pb1^2+pb2^2)
ps:=sqrt(ps1^2)
pt:=sqrt(pt1^2+pt2^2)
pa:=sqrt(pa1^2+pa2^2+pa3^2)
fb:=sqrt(fb1^2+fb2^2)
fs:=sqrt(fs1^2)
ft:=sqrt(ft1^2+ft2^2+ft3^2)
fa:=sqrt(fa1^2+fa2^2+fa3^2)
'
modS='hzoop~hb1*chla_1+hs1*hzoop_1+ht1*pzoop_1+ht2*corbic_1+ht3*estfish_bsmt_1+ha1*flow+ha2*temp+ha3*turbid
pzoop~pb1*chla_1+pb2*hzoop_1+ps1*pzoop_1+pt1*corbic_1+pt2*estfish_bsmt_1+pa1*flow+pa2*temp+pa3*turbid
estfish_bsmt~fb1*chla_1+fb2*hzoop_1+fb3*pzoop_1+fs1*estfish_bsmt_1+fa1*flow+fa2*temp+fa3*turbid+ft1*sside_1+ft2*cent_1+ft3*sbass1_bsmt_1
hb:=sqrt(hb1^2)
hs:=sqrt(hs1^2)
ht:=sqrt(ht1^2+ht2^2+ht3^2)
ha:=sqrt(ha1^2+ha2^2+ha3^2)
pb:=sqrt(pb1^2+pb2^2)
ps:=sqrt(ps1^2)
pt:=sqrt(pt1^2+pt2^2)
pa:=sqrt(pa1^2+pa2^2+pa3^2)
fb:=sqrt(fb1^2+fb2^2+fb3^2)
fs:=sqrt(fs1^2)
ft:=sqrt(ft1^2+ft2^2+ft3^2)
fa:=sqrt(fa1^2+fa2^2+fa3^2)
'
modfitFW=sem(modFW, data=filter(fdr_ds,region=="Far West"))
modfitW=sem(modW, data=filter(fdr_ds,region=="West"))
modfitN=sem(modN, data=filter(fdr_ds,region=="North"))
modfitS=sem(modS, data=filter(fdr_ds,region=="South"))
summary(modfitFW, standardized=T, rsq=T)
## lavaan 0.6-11 ended normally after 14 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 29
##
## Used Total
## Number of observations 191 312
##
## Model Test User Model:
##
## Test statistic 7.294
## Degrees of freedom 7
## P-value (Chi-square) 0.399
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## hzoop ~
## chla_1 (hb1) 0.019 0.076 0.246 0.806 0.019 0.016
## hzoop_1 (hs1) 0.313 0.065 4.820 0.000 0.313 0.324
## pzoop_1 (ht1) 0.062 0.062 0.997 0.319 0.062 0.066
## potam_1 (ht2) -0.190 0.058 -3.263 0.001 -0.190 -0.213
## estfs__1 (ht3) -0.175 0.069 -2.536 0.011 -0.175 -0.174
## flow (ha1) -0.022 0.075 -0.298 0.766 -0.022 -0.022
## temp (ha2) -0.080 0.072 -1.104 0.270 -0.080 -0.076
## turbid (ha3) 0.042 0.080 0.522 0.602 0.042 0.038
## pzoop ~
## hzoop_1 (pb1) 0.054 0.067 0.810 0.418 0.054 0.054
## pzoop_1 (ps1) 0.344 0.065 5.278 0.000 0.344 0.348
## potam_1 (pt1) -0.102 0.060 -1.697 0.090 -0.102 -0.110
## estfs__1 (pt2) -0.031 0.072 -0.428 0.669 -0.031 -0.029
## flow (pa1) 0.082 0.078 1.050 0.294 0.082 0.076
## temp (pa2) -0.020 0.075 -0.268 0.789 -0.020 -0.018
## turbid (pa3) 0.252 0.084 3.006 0.003 0.252 0.215
## estfish_bsmt ~
## hzoop_1 (fb1) -0.178 0.056 -3.151 0.002 -0.178 -0.192
## pzoop_1 (fb2) 0.116 0.056 2.076 0.038 0.116 0.128
## estfs__1 (fs1) 0.343 0.064 5.369 0.000 0.343 0.355
## flow (fa1) 0.092 0.068 1.349 0.177 0.092 0.092
## temp (fa2) -0.032 0.065 -0.496 0.620 -0.032 -0.032
## turbid (fa3) 0.246 0.073 3.389 0.001 0.246 0.230
## mrfsh__1 (ft1) 0.001 0.064 0.018 0.986 0.001 0.001
## sbss1__1 (ft2) -0.018 0.065 -0.281 0.778 -0.018 -0.018
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .hzoop ~~
## .pzoop -0.035 0.058 -0.595 0.552 -0.035 -0.043
## .estfish_bsmt -0.046 0.050 -0.918 0.359 -0.046 -0.067
## .pzoop ~~
## .estfish_bsmt -0.088 0.052 -1.684 0.092 -0.088 -0.123
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .hzoop 0.772 0.079 9.772 0.000 0.772 0.754
## .pzoop 0.842 0.086 9.772 0.000 0.842 0.750
## .estfish_bsmt 0.606 0.062 9.772 0.000 0.606 0.641
##
## R-Square:
## Estimate
## hzoop 0.246
## pzoop 0.250
## estfish_bsmt 0.359
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## hb 0.019 0.076 0.246 0.806 0.019 0.016
## hs 0.313 0.065 4.820 0.000 0.313 0.324
## ht 0.266 0.057 4.623 0.000 0.266 0.283
## ha 0.093 0.072 1.288 0.198 0.093 0.087
## pb 0.054 0.067 0.810 0.418 0.054 0.054
## ps 0.344 0.065 5.278 0.000 0.344 0.348
## pt 0.107 0.058 1.837 0.066 0.107 0.113
## pa 0.265 0.073 3.627 0.000 0.265 0.229
## fb 0.212 0.059 3.618 0.000 0.212 0.231
## fs 0.343 0.064 5.369 0.000 0.343 0.355
## ft 0.018 0.064 0.283 0.777 0.018 0.018
## fa 0.265 0.062 4.262 0.000 0.265 0.249
summary(modfitW, standardized=T, rsq=T)
## lavaan 0.6-11 ended normally after 17 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 29
##
## Used Total
## Number of observations 210 312
##
## Model Test User Model:
##
## Test statistic 2.534
## Degrees of freedom 4
## P-value (Chi-square) 0.638
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## hzoop ~
## chla_1 (hb1) 0.089 0.068 1.313 0.189 0.089 0.080
## hzoop_1 (hs1) 0.359 0.071 5.031 0.000 0.359 0.348
## pzoop_1 (ht1) 0.034 0.064 0.528 0.597 0.034 0.033
## potam_1 (ht2) -0.231 0.069 -3.373 0.001 -0.231 -0.216
## estfs__1 (ht3) -0.017 0.063 -0.268 0.789 -0.017 -0.016
## flow (ha1) 0.197 0.070 2.831 0.005 0.197 0.184
## temp (ha2) 0.026 0.061 0.433 0.665 0.026 0.026
## turbid (ha3) -0.203 0.068 -2.982 0.003 -0.203 -0.188
## pzoop ~
## chla_1 (pb1) 0.192 0.065 2.964 0.003 0.192 0.179
## hzoop_1 (pb2) 0.117 0.069 1.698 0.089 0.117 0.117
## pzoop_1 (ps1) 0.415 0.062 6.679 0.000 0.415 0.411
## potam_1 (pt1) -0.086 0.066 -1.301 0.193 -0.086 -0.082
## estfs__1 (pt2) 0.037 0.061 0.603 0.546 0.037 0.036
## flow (pa1) -0.105 0.068 -1.556 0.120 -0.105 -0.101
## temp (pa2) 0.186 0.059 3.160 0.002 0.186 0.189
## turbid (pa3) 0.035 0.066 0.530 0.596 0.035 0.033
## estfish_bsmt ~
## hzoop_1 (fb1) 0.135 0.071 1.896 0.058 0.135 0.132
## pzoop_1 (fb2) -0.079 0.069 -1.147 0.252 -0.079 -0.077
## estfs__1 (fs1) 0.175 0.072 2.427 0.015 0.175 0.169
## flow (fa1) -0.221 0.074 -2.984 0.003 -0.221 -0.210
## temp (fa2) 0.017 0.064 0.265 0.791 0.017 0.017
## turbid (fa3) 0.248 0.071 3.502 0.000 0.248 0.232
## sbss1__1 (ft1) 0.234 0.069 3.392 0.001 0.234 0.225
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .hzoop ~~
## .pzoop 0.178 0.049 3.639 0.000 0.178 0.259
## .estfish_bsmt -0.077 0.053 -1.474 0.141 -0.077 -0.102
## .pzoop ~~
## .estfish_bsmt 0.137 0.052 2.660 0.008 0.137 0.187
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .hzoop 0.707 0.069 10.247 0.000 0.707 0.668
## .pzoop 0.667 0.065 10.247 0.000 0.667 0.668
## .estfish_bsmt 0.813 0.079 10.247 0.000 0.813 0.787
##
## R-Square:
## Estimate
## hzoop 0.332
## pzoop 0.332
## estfish_bsmt 0.213
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## hb 0.089 0.068 1.313 0.189 0.089 0.080
## hs 0.359 0.071 5.031 0.000 0.359 0.348
## ht 0.234 0.069 3.405 0.001 0.234 0.219
## ha 0.284 0.076 3.756 0.000 0.284 0.264
## pb 0.225 0.057 3.952 0.000 0.225 0.214
## ps 0.415 0.062 6.679 0.000 0.415 0.411
## pt 0.093 0.062 1.493 0.136 0.093 0.090
## pa 0.216 0.063 3.456 0.001 0.216 0.217
## fb 0.156 0.080 1.956 0.051 0.156 0.153
## fs 0.175 0.072 2.427 0.015 0.175 0.169
## ft 0.234 0.069 3.392 0.001 0.234 0.225
## fa 0.333 0.082 4.057 0.000 0.333 0.313
summary(modfitN, standardized=T, rsq=T)
## lavaan 0.6-11 ended normally after 16 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 31
##
## Used Total
## Number of observations 193 312
##
## Model Test User Model:
##
## Test statistic 8.135
## Degrees of freedom 8
## P-value (Chi-square) 0.420
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## hzoop ~
## chla_1 (hb1) 0.036 0.072 0.501 0.617 0.036 0.033
## hzoop_1 (hs1) 0.216 0.070 3.072 0.002 0.216 0.212
## pzoop_1 (ht1) 0.040 0.073 0.549 0.583 0.040 0.039
## corbic_1 (ht2) 0.004 0.068 0.065 0.948 0.004 0.004
## estfs__1 (ht3) -0.079 0.068 -1.158 0.247 -0.079 -0.084
## flow (ha1) 0.242 0.075 3.208 0.001 0.242 0.242
## temp (ha2) 0.107 0.066 1.625 0.104 0.107 0.111
## turbid (ha3) 0.190 0.070 2.726 0.006 0.190 0.185
## pzoop ~
## chla_1 (pb1) 0.266 0.064 4.135 0.000 0.266 0.245
## hzoop_1 (pb2) 0.177 0.063 2.822 0.005 0.177 0.173
## pzoop_1 (ps1) 0.233 0.065 3.590 0.000 0.233 0.229
## corbic_1 (pt1) 0.030 0.060 0.503 0.615 0.030 0.030
## estfs__1 (pt2) -0.059 0.060 -0.977 0.329 -0.059 -0.063
## flow (pa1) -0.435 0.067 -6.487 0.000 -0.435 -0.434
## temp (pa2) 0.080 0.059 1.366 0.172 0.080 0.083
## turbid (pa3) 0.004 0.062 0.067 0.946 0.004 0.004
## estfish_bsmt ~
## hzoop_1 (fb1) 0.152 0.074 2.057 0.040 0.152 0.139
## pzoop_1 (fb2) 0.012 0.075 0.162 0.871 0.012 0.011
## estfs__1 (fs1) 0.130 0.071 1.824 0.068 0.130 0.129
## flow (fa1) -0.468 0.078 -6.001 0.000 -0.468 -0.435
## temp (fa2) -0.016 0.067 -0.237 0.813 -0.016 -0.015
## turbid (fa3) 0.066 0.073 0.911 0.362 0.066 0.060
## sside_1 (ft1) -0.018 0.068 -0.262 0.793 -0.018 -0.017
## cent_1 (ft2) -0.132 0.069 -1.914 0.056 -0.132 -0.125
## sbss1__1 (ft3) 0.095 0.071 1.331 0.183 0.095 0.090
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .hzoop ~~
## .pzoop 0.178 0.053 3.359 0.001 0.178 0.249
## .estfish_bsmt -0.059 0.059 -0.995 0.320 -0.059 -0.072
## .pzoop ~~
## .estfish_bsmt -0.001 0.052 -0.028 0.978 -0.001 -0.002
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .hzoop 0.803 0.082 9.823 0.000 0.803 0.816
## .pzoop 0.633 0.064 9.823 0.000 0.633 0.643
## .estfish_bsmt 0.830 0.085 9.823 0.000 0.830 0.731
##
## R-Square:
## Estimate
## hzoop 0.184
## pzoop 0.357
## estfish_bsmt 0.269
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## hb 0.036 0.072 0.501 0.617 0.036 0.033
## hs 0.216 0.070 3.072 0.002 0.216 0.212
## ht 0.088 0.075 1.171 0.242 0.088 0.093
## ha 0.326 0.071 4.617 0.000 0.326 0.324
## pb 0.319 0.062 5.157 0.000 0.319 0.300
## ps 0.233 0.065 3.590 0.000 0.233 0.229
## pt 0.066 0.063 1.058 0.290 0.066 0.070
## pa 0.442 0.065 6.826 0.000 0.442 0.442
## fb 0.152 0.072 2.107 0.035 0.152 0.139
## fs 0.130 0.071 1.824 0.068 0.130 0.129
## ft 0.163 0.063 2.586 0.010 0.163 0.156
## fa 0.473 0.080 5.935 0.000 0.473 0.440
summary(modfitS, standardized=T, rsq=T)
## lavaan 0.6-11 ended normally after 14 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 32
##
## Used Total
## Number of observations 199 312
##
## Model Test User Model:
##
## Test statistic 5.739
## Degrees of freedom 7
## P-value (Chi-square) 0.571
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## hzoop ~
## chla_1 (hb1) 0.254 0.072 3.525 0.000 0.254 0.237
## hzoop_1 (hs1) 0.215 0.069 3.115 0.002 0.215 0.206
## pzoop_1 (ht1) -0.024 0.076 -0.322 0.747 -0.024 -0.022
## corbic_1 (ht2) 0.073 0.070 1.041 0.298 0.073 0.068
## estfs__1 (ht3) 0.007 0.069 0.099 0.921 0.007 0.007
## flow (ha1) 0.214 0.071 2.995 0.003 0.214 0.196
## temp (ha2) 0.172 0.066 2.585 0.010 0.172 0.169
## turbid (ha3) -0.041 0.068 -0.601 0.548 -0.041 -0.040
## pzoop ~
## chla_1 (pb1) 0.295 0.061 4.854 0.000 0.295 0.294
## hzoop_1 (pb2) 0.149 0.058 2.558 0.011 0.149 0.153
## pzoop_1 (ps1) 0.324 0.064 5.095 0.000 0.324 0.321
## corbic_1 (pt1) -0.062 0.058 -1.066 0.286 -0.062 -0.062
## estfs__1 (pt2) 0.020 0.058 0.344 0.731 0.020 0.021
## flow (pa1) -0.132 0.060 -2.186 0.029 -0.132 -0.129
## temp (pa2) -0.035 0.056 -0.627 0.530 -0.035 -0.037
## turbid (pa3) 0.096 0.057 1.694 0.090 0.096 0.101
## estfish_bsmt ~
## chla_1 (fb1) 0.141 0.070 2.002 0.045 0.141 0.135
## hzoop_1 (fb2) 0.143 0.068 2.097 0.036 0.143 0.142
## pzoop_1 (fb3) -0.049 0.074 -0.671 0.502 -0.049 -0.047
## estfs__1 (fs1) 0.192 0.068 2.814 0.005 0.192 0.196
## flow (fa1) -0.095 0.071 -1.351 0.177 -0.095 -0.090
## temp (fa2) -0.028 0.065 -0.430 0.667 -0.028 -0.028
## turbid (fa3) 0.210 0.071 2.945 0.003 0.210 0.212
## sside_1 (ft1) 0.056 0.065 0.873 0.383 0.056 0.056
## cent_1 (ft2) -0.075 0.067 -1.115 0.265 -0.075 -0.078
## sbss1__1 (ft3) 0.066 0.068 0.957 0.338 0.066 0.066
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .hzoop ~~
## .pzoop 0.117 0.051 2.296 0.022 0.117 0.165
## .estfish_bsmt 0.043 0.058 0.747 0.455 0.043 0.053
## .pzoop ~~
## .estfish_bsmt 0.131 0.049 2.648 0.008 0.131 0.191
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .hzoop 0.839 0.084 9.975 0.000 0.839 0.811
## .pzoop 0.594 0.060 9.975 0.000 0.594 0.661
## .estfish_bsmt 0.785 0.079 9.975 0.000 0.785 0.811
##
## R-Square:
## Estimate
## hzoop 0.189
## pzoop 0.339
## estfish_bsmt 0.189
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## hb 0.254 0.072 3.525 0.000 0.254 0.237
## hs 0.215 0.069 3.115 0.002 0.215 0.206
## ht 0.077 0.072 1.070 0.285 0.077 0.072
## ha 0.277 0.071 3.928 0.000 0.277 0.262
## pb 0.330 0.057 5.768 0.000 0.330 0.332
## ps 0.324 0.064 5.095 0.000 0.324 0.321
## pt 0.065 0.057 1.134 0.257 0.065 0.065
## pa 0.167 0.062 2.700 0.007 0.167 0.168
## fb 0.207 0.070 2.962 0.003 0.207 0.202
## fs 0.192 0.068 2.814 0.005 0.192 0.196
## ft 0.114 0.065 1.762 0.078 0.114 0.117
## fa 0.233 0.076 3.052 0.002 0.233 0.232
#modificationindices(modfitW, sort=T, maximum.number=20)
#residuals(modfitS)
labelsfarwest=createLabels(modfitFW, cnameslag)
labelswest=createLabels(modfitW, cnameslag)
labelsnorth=createLabels(modfitN, cnameslag)
labelssouth=createLabels(modfitS, cnameslag)
#Extract model coefficients for table
coef_table<-coef_tabler(modfitFW, modfitW, modfitN, modfitS, name="Upper trophic level aggregates")
#FAR WEST
# myLavaanPlot(model=modfitFW, labels=labelsfarwest,
# node_options=list(shape="box", fontname="Helvetica"),
# coefs=TRUE, stand=TRUE, covs=FALSE, sig=0.05,
# width=c("regress","latent"),
# color=c("regress","latent"))
upper_plot_far_west <- createGraph(fit=modfitFW,
reference_df=cnameslag,
model_type="monthly_upper_trophic",
title="Far West",
manual_port_settings=TRUE)
upper_plot_far_west
#WEST
# myLavaanPlot(model=modfitW, labels=labelswest,
# node_options=list(shape="box", fontname="Helvetica"),
# coefs=TRUE, stand=TRUE, covs=FALSE, sig=0.05,
# width=c("regress","latent"),
# color=c("regress","latent"))
upper_plot_west <- createGraph(fit=modfitW,
reference_df=cnameslag,
model_type="monthly_upper_trophic",
title="West",
manual_port_settings=TRUE)
upper_plot_west
#NORTH
# myLavaanPlot(model=modfitN, labels=labelsnorth,
# node_options=list(shape="box", fontname="Helvetica"),
# coefs=TRUE, stand=TRUE, covs=FALSE, sig=0.05,
# width=c("regress","latent"),
# color=c("regress","latent"))
upper_plot_north <- createGraph(fit=modfitN,
reference_df=cnameslag,
model_type="monthly_upper_trophic",
title="North",
manual_port_settings=TRUE)
upper_plot_north
#SOUTH
# myLavaanPlot(model=modfitS, labels=labelssouth,
# node_options=list(shape="box", fontname="Helvetica"),
# coefs=TRUE, stand=TRUE, covs=FALSE, sig=0.05,
# width=c("regress","latent"),
# color=c("regress","latent"))
upper_plot_south <- createGraph(fit=modfitS,
reference_df=cnameslag,
model_type="monthly_upper_trophic",
title="South",
manual_port_settings=TRUE)
upper_plot_south
Save updated SEM diagrams
Total effects
ssFW=standardizedsolution(modfitFW) %>% mutate(region="Far West")
ssW=standardizedsolution(modfitW) %>% mutate(region="West")
ssN=standardizedsolution(modfitN) %>% mutate(region="North")
ssS=standardizedsolution(modfitS) %>% mutate(region="South")
ssut=rbind(ssFW,ssW,ssN,ssS) %>% filter(op==":=") %>% select(region,lhs,est.std:ci.upper) %>%
separate(lhs,c("variable","influence"), sep=1) %>%
mutate(variable=case_when(variable=="h" ~ "herbivorous\nzooplankton",
variable=="p" ~ "predatory\nzooplankton",
variable=="f" ~ "estuarine\nfishes"),
influence=case_when(influence=="b" ~ "bottom-up",
influence=="t" ~ "top-down",
influence=="s" ~ "self-regulation",
influence=="a" ~ "abiotic drivers"),
region=factor(region, levels=regionorder),
influence=factor(influence, levels=c("self-regulation","bottom-up","top-down","abiotic drivers")),
variable=factor(variable,levels=c("estuarine\nfishes","predatory\nzooplankton","herbivorous\nzooplankton")),
sig=ifelse(pvalue<0.05,"*",""))
ggplot(ssut,aes(x=influence,y=est.std)) +
facet_grid(variable~region) +
geom_errorbar(aes(ymin=ci.lower, ymax=ci.upper),width=0.5) +
geom_point() +
geom_text(aes(y=ci.upper+0.05, label=sig)) +
geom_hline(yintercept = 0) +
theme_bw() + theme(axis.text.x=element_text(angle=90, vjust=0.5, hjust=1)) +
labs(y="total effect (standardized)")
ggsave("./fig_output/uteffects.png",width = 6,height=5)
modFW='din~ns1*din_1+nt1*chla+nn1*hzoop_1+nn2*pzoop_1+nn3*potam_1+na1*flow+na2*temp+na3*turbid
chla~cb1*din_1+cs1*chla_1+ct1*hzoop_1+ct2*potam_1+ca1*flow+ca2*temp+ca3*turbid
potam~lb1*chla_1+lb2*hzoop_1+lb3*pzoop_1+ls1*potam_1+la1*flow+la2*temp+la3*turbid
ns:=sqrt(ns1^2)
nt:=sqrt(nt1^2)
nn:=sqrt(nn1^2+nn2^2+nn3^2)
na:=sqrt(na1^2+na2^2+na3^2)
cb:=sqrt(cb1^2)
cs:=sqrt(cs1^2)
ct:=sqrt(ct1^2+ct2^2)
ca:=sqrt(ca1^2+ca2^2+ca3^2)
lb:=sqrt(lb1^2+lb2^2+lb3^2)
ls:=sqrt(ls1^2)
la:=sqrt(la1^2+la2^2+la3^2)
'
modW='din~ns1*din_1+nt1*chla+nn1*hzoop_1+nn2*pzoop_1+nn3*potam_1+na1*flow+na2*temp+na3*turbid
chla~cb1*din_1+cs1*chla_1+ct1*hzoop_1+ct2*potam_1+ca1*flow+ca2*temp+ca3*turbid
potam~lb1*din_1+lb2*chla_1+lb3*hzoop_1+lb4*pzoop_1+ls1*potam_1+la1*flow+la2*temp+la3*turbid
ns:=sqrt(ns1^2)
nt:=sqrt(nt1^2)
nn:=sqrt(nn1^2+nn2^2+nn3^2)
na:=sqrt(na1^2+na2^2+na3^2)
cb:=sqrt(cb1^2)
cs:=sqrt(cs1^2)
ct:=sqrt(ct1^2+ct2^2)
ca:=sqrt(ca1^2+ca2^2+ca3^2)
lb:=sqrt(lb1^2+lb2^2+lb3^2+lb4^2)
ls:=sqrt(ls1^2)
la:=sqrt(la1^2+la2^2+la3^2)
'
modN='din~ns1*din_1+nt1*chla+nn1*hzoop_1+nn2*pzoop_1+nn3*corbic_1+na1*flow+na2*temp+na3*turbid
chla~cb1*din_1+cs1*chla_1+ct1*hzoop_1+ct2*corbic_1+ct3*pzoop_1+ca1*flow+ca2*temp+ca3*turbid
corbic~lb1*chla_1+lb2*hzoop_1+lb3*pzoop_1+ls1*corbic_1+la1*flow+la2*temp+la3*turbid
ns:=sqrt(ns1^2)
nt:=sqrt(nt1^2)
nn:=sqrt(nn1^2+nn2^2+nn3^2)
na:=sqrt(na1^2+na2^2+na3^2)
cb:=sqrt(cb1^2)
cs:=sqrt(cs1^2)
ct:=sqrt(ct1^2+ct2^2+ct3^2)
ca:=sqrt(ca1^2+ca2^2+ca3^2)
lb:=sqrt(lb1^2+lb2^2+lb3^2)
ls:=sqrt(ls1^2)
la:=sqrt(la1^2+la2^2+la3^2)
'
modS='din~ns1*din_1+nt1*chla+nn1*hzoop_1+nn2*pzoop_1+nn3*corbic_1+na1*flow+na2*temp+na3*turbid
chla~cb1*din_1+cs1*chla_1+ct1*hzoop_1+ct2*corbic_1+ca1*flow+ca2*temp+ca3*turbid
corbic~lb1*chla_1+lb2*hzoop_1+lb3*pzoop_1+ls1*corbic_1+la1*flow+la2*temp+la3*turbid
ns:=sqrt(ns1^2)
nt:=sqrt(nt1^2)
nn:=sqrt(nn1^2+nn2^2+nn3^2)
na:=sqrt(na1^2+na2^2+na3^2)
cb:=sqrt(cb1^2)
cs:=sqrt(cs1^2)
ct:=sqrt(ct1^2+ct2^2)
ca:=sqrt(ca1^2+ca2^2+ca3^2)
lb:=sqrt(lb1^2+lb2^2+lb3^2)
ls:=sqrt(ls1^2)
la:=sqrt(la1^2+la2^2+la3^2)
'
modfitFW=sem(modFW, data=filter(fdr_ds,region=="Far West"))
modfitW=sem(modW, data=filter(fdr_ds,region=="West"))
modfitN=sem(modN, data=filter(fdr_ds,region=="North"))
modfitS=sem(modS, data=filter(fdr_ds,region=="South"))
summary(modfitFW, standardized=T, rsq=T)
## lavaan 0.6-11 ended normally after 12 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 26
##
## Used Total
## Number of observations 234 312
##
## Model Test User Model:
##
## Test statistic 1.413
## Degrees of freedom 4
## P-value (Chi-square) 0.842
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## din ~
## din_1 (ns1) 0.426 0.057 7.407 0.000 0.426 0.426
## chla (nt1) -0.163 0.072 -2.270 0.023 -0.163 -0.130
## hzoop_1 (nn1) 0.030 0.060 0.499 0.618 0.030 0.030
## pzoop_1 (nn2) -0.022 0.058 -0.376 0.707 -0.022 -0.022
## potam_1 (nn3) -0.006 0.057 -0.101 0.919 -0.006 -0.006
## flow (na1) -0.013 0.067 -0.189 0.850 -0.013 -0.012
## temp (na2) -0.156 0.064 -2.430 0.015 -0.156 -0.149
## turbid (na3) -0.138 0.068 -2.036 0.042 -0.138 -0.130
## chla ~
## din_1 (cb1) 0.016 0.051 0.315 0.752 0.016 0.020
## chla_1 (cs1) 0.259 0.063 4.115 0.000 0.259 0.263
## hzoop_1 (ct1) -0.014 0.053 -0.276 0.783 -0.014 -0.018
## potam_1 (ct2) -0.018 0.050 -0.366 0.714 -0.018 -0.023
## flow (ca1) 0.063 0.058 1.080 0.280 0.063 0.074
## temp (ca2) 0.128 0.056 2.284 0.022 0.128 0.154
## turbid (ca3) -0.047 0.060 -0.790 0.429 -0.047 -0.055
## potam ~
## chla_1 (lb1) 0.065 0.060 1.080 0.280 0.065 0.051
## hzoop_1 (lb2) -0.074 0.051 -1.454 0.146 -0.074 -0.072
## pzoop_1 (lb3) -0.163 0.050 -3.258 0.001 -0.163 -0.161
## potam_1 (ls1) 0.629 0.048 13.019 0.000 0.629 0.629
## flow (la1) 0.113 0.057 1.978 0.048 0.113 0.103
## temp (la2) -0.043 0.054 -0.784 0.433 -0.043 -0.040
## turbid (la3) 0.037 0.058 0.633 0.527 0.037 0.033
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .din ~~
## .potam -0.045 0.044 -1.023 0.306 -0.045 -0.067
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .din 0.778 0.072 10.817 0.000 0.778 0.753
## .chla 0.602 0.056 10.817 0.000 0.602 0.908
## .potam 0.568 0.053 10.817 0.000 0.568 0.518
##
## R-Square:
## Estimate
## din 0.247
## chla 0.092
## potam 0.482
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## ns 0.426 0.057 7.407 0.000 0.426 0.426
## nt 0.163 0.072 2.270 0.023 0.163 0.130
## nn 0.037 0.061 0.615 0.539 0.037 0.038
## na 0.209 0.072 2.887 0.004 0.209 0.198
## cb 0.016 0.051 0.315 0.752 0.016 0.020
## cs 0.259 0.063 4.115 0.000 0.259 0.263
## ct 0.023 0.056 0.418 0.676 0.023 0.030
## ca 0.150 0.058 2.612 0.009 0.150 0.179
## lb 0.190 0.049 3.853 0.000 0.190 0.183
## ls 0.629 0.048 13.019 0.000 0.629 0.629
## la 0.126 0.049 2.576 0.010 0.126 0.116
summary(modfitW, standardized=T, rsq=T)
## lavaan 0.6-11 ended normally after 17 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 27
##
## Used Total
## Number of observations 257 312
##
## Model Test User Model:
##
## Test statistic 6.565
## Degrees of freedom 3
## P-value (Chi-square) 0.087
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## din ~
## din_1 (ns1) 0.410 0.052 7.839 0.000 0.410 0.409
## chla (nt1) -0.142 0.052 -2.721 0.007 -0.142 -0.128
## hzoop_1 (nn1) 0.008 0.052 0.161 0.872 0.008 0.009
## pzoop_1 (nn2) 0.044 0.049 0.904 0.366 0.044 0.044
## potam_1 (nn3) 0.076 0.053 1.439 0.150 0.076 0.077
## flow (na1) -0.356 0.054 -6.551 0.000 -0.356 -0.347
## temp (na2) 0.026 0.047 0.557 0.577 0.026 0.026
## turbid (na3) 0.107 0.050 2.113 0.035 0.107 0.106
## chla ~
## din_1 (cb1) -0.126 0.062 -2.019 0.043 -0.126 -0.140
## chla_1 (cs1) 0.148 0.065 2.279 0.023 0.148 0.148
## hzoop_1 (ct1) 0.093 0.059 1.573 0.116 0.093 0.106
## potam_1 (ct2) 0.037 0.063 0.596 0.551 0.037 0.042
## flow (ca1) 0.047 0.063 0.746 0.456 0.047 0.051
## temp (ca2) -0.061 0.055 -1.110 0.267 -0.061 -0.068
## turbid (ca3) -0.025 0.059 -0.427 0.670 -0.025 -0.028
## potam ~
## din_1 (lb1) 0.074 0.044 1.692 0.091 0.074 0.073
## chla_1 (lb2) -0.014 0.046 -0.303 0.762 -0.014 -0.012
## hzoop_1 (lb3) -0.006 0.044 -0.128 0.898 -0.006 -0.006
## pzoop_1 (lb4) 0.071 0.041 1.751 0.080 0.071 0.071
## potam_1 (ls1) 0.708 0.044 16.008 0.000 0.708 0.702
## flow (la1) -0.112 0.045 -2.497 0.013 -0.112 -0.108
## temp (la2) -0.009 0.039 -0.223 0.823 -0.009 -0.009
## turbid (la3) -0.079 0.042 -1.895 0.058 -0.079 -0.078
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .din ~~
## .potam 0.037 0.027 1.379 0.168 0.037 0.086
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .din 0.523 0.046 11.336 0.000 0.523 0.525
## .chla 0.726 0.064 11.336 0.000 0.726 0.900
## .potam 0.359 0.032 11.336 0.000 0.359 0.351
##
## R-Square:
## Estimate
## din 0.475
## chla 0.100
## potam 0.649
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## ns 0.410 0.052 7.839 0.000 0.410 0.409
## nt 0.142 0.052 2.721 0.007 0.142 0.128
## nn 0.089 0.053 1.666 0.096 0.089 0.089
## na 0.373 0.057 6.577 0.000 0.373 0.364
## cb 0.126 0.062 2.019 0.043 0.126 0.140
## cs 0.148 0.065 2.279 0.023 0.148 0.148
## ct 0.100 0.064 1.550 0.121 0.100 0.114
## ca 0.081 0.061 1.330 0.184 0.081 0.090
## lb 0.104 0.041 2.519 0.012 0.104 0.103
## ls 0.708 0.044 16.008 0.000 0.708 0.702
## la 0.138 0.040 3.423 0.001 0.138 0.134
summary(modfitN, standardized=T, rsq=T)
## lavaan 0.6-11 ended normally after 11 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 27
##
## Used Total
## Number of observations 255 312
##
## Model Test User Model:
##
## Test statistic 5.384
## Degrees of freedom 3
## P-value (Chi-square) 0.146
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## din ~
## din_1 (ns1) 0.129 0.053 2.407 0.016 0.129 0.130
## chla (nt1) -0.173 0.050 -3.491 0.000 -0.173 -0.175
## hzoop_1 (nn1) 0.048 0.052 0.920 0.358 0.048 0.048
## pzoop_1 (nn2) 0.176 0.054 3.249 0.001 0.176 0.174
## corbic_1 (nn3) -0.027 0.051 -0.523 0.601 -0.027 -0.026
## flow (na1) -0.468 0.057 -8.165 0.000 -0.468 -0.459
## temp (na2) 0.027 0.051 0.534 0.594 0.027 0.027
## turbid (na3) 0.056 0.049 1.139 0.255 0.056 0.057
## chla ~
## din_1 (cb1) 0.025 0.066 0.380 0.704 0.025 0.025
## chla_1 (cs1) 0.279 0.060 4.645 0.000 0.279 0.281
## hzoop_1 (ct1) -0.050 0.063 -0.804 0.421 -0.050 -0.050
## corbic_1 (ct2) 0.017 0.062 0.267 0.789 0.017 0.016
## pzoop_1 (ct3) -0.169 0.066 -2.573 0.010 -0.169 -0.166
## flow (ca1) -0.054 0.069 -0.782 0.434 -0.054 -0.053
## temp (ca2) 0.136 0.061 2.218 0.027 0.136 0.136
## turbid (ca3) 0.077 0.059 1.298 0.194 0.077 0.078
## corbic ~
## chla_1 (lb1) 0.003 0.053 0.057 0.954 0.003 0.003
## hzoop_1 (lb2) 0.011 0.056 0.194 0.846 0.011 0.011
## pzoop_1 (lb3) -0.011 0.058 -0.185 0.853 -0.011 -0.011
## corbic_1 (ls1) 0.463 0.056 8.312 0.000 0.463 0.460
## flow (la1) 0.093 0.060 1.552 0.121 0.093 0.092
## temp (la2) -0.034 0.055 -0.614 0.539 -0.034 -0.034
## turbid (la3) -0.117 0.053 -2.212 0.027 -0.117 -0.121
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .din ~~
## .corbic -0.017 0.041 -0.418 0.676 -0.017 -0.026
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .din 0.602 0.053 11.292 0.000 0.602 0.610
## .chla 0.882 0.078 11.292 0.000 0.882 0.879
## .corbic 0.715 0.063 11.292 0.000 0.715 0.740
##
## R-Square:
## Estimate
## din 0.390
## chla 0.121
## corbic 0.260
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## ns 0.129 0.053 2.407 0.016 0.129 0.130
## nt 0.173 0.050 3.491 0.000 0.173 0.175
## nn 0.185 0.051 3.645 0.000 0.185 0.182
## na 0.473 0.058 8.206 0.000 0.473 0.463
## cb 0.025 0.066 0.380 0.704 0.025 0.025
## cs 0.279 0.060 4.645 0.000 0.279 0.281
## ct 0.177 0.061 2.899 0.004 0.177 0.174
## ca 0.165 0.061 2.726 0.006 0.165 0.165
## lb 0.016 0.063 0.248 0.804 0.016 0.016
## ls 0.463 0.056 8.312 0.000 0.463 0.460
## la 0.153 0.057 2.689 0.007 0.153 0.156
summary(modfitS, standardized=T, rsq=T)
## lavaan 0.6-11 ended normally after 10 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 26
##
## Used Total
## Number of observations 256 312
##
## Model Test User Model:
##
## Test statistic 2.680
## Degrees of freedom 4
## P-value (Chi-square) 0.613
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## din ~
## din_1 (ns1) 0.203 0.061 3.318 0.001 0.203 0.204
## chla (nt1) 0.026 0.059 0.445 0.656 0.026 0.026
## hzoop_1 (nn1) -0.026 0.064 -0.403 0.687 -0.026 -0.024
## pzoop_1 (nn2) 0.028 0.064 0.438 0.662 0.028 0.026
## corbic_1 (nn3) 0.073 0.060 1.215 0.224 0.073 0.073
## flow (na1) -0.005 0.061 -0.088 0.930 -0.005 -0.005
## temp (na2) 0.096 0.060 1.610 0.107 0.096 0.095
## turbid (na3) 0.252 0.063 3.997 0.000 0.252 0.249
## chla ~
## din_1 (cb1) -0.007 0.062 -0.120 0.905 -0.007 -0.008
## chla_1 (cs1) 0.285 0.061 4.690 0.000 0.285 0.285
## hzoop_1 (ct1) 0.075 0.064 1.165 0.244 0.075 0.072
## corbic_1 (ct2) 0.086 0.060 1.429 0.153 0.086 0.087
## flow (ca1) -0.118 0.061 -1.931 0.053 -0.118 -0.116
## temp (ca2) 0.020 0.059 0.341 0.733 0.020 0.020
## turbid (ca3) 0.017 0.064 0.263 0.793 0.017 0.017
## corbic ~
## chla_1 (lb1) 0.053 0.059 0.899 0.369 0.053 0.053
## hzoop_1 (lb2) -0.024 0.062 -0.392 0.695 -0.024 -0.023
## pzoop_1 (lb3) -0.041 0.063 -0.658 0.511 -0.041 -0.039
## corbic_1 (ls1) 0.315 0.058 5.477 0.000 0.315 0.318
## flow (la1) 0.082 0.059 1.396 0.163 0.082 0.081
## temp (la2) -0.078 0.058 -1.352 0.176 -0.078 -0.078
## turbid (la3) 0.185 0.058 3.195 0.001 0.185 0.185
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .din ~~
## .corbic -0.074 0.053 -1.403 0.161 -0.074 -0.088
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .din 0.869 0.077 11.314 0.000 0.869 0.845
## .chla 0.880 0.078 11.314 0.000 0.880 0.881
## .corbic 0.812 0.072 11.314 0.000 0.812 0.809
##
## R-Square:
## Estimate
## din 0.155
## chla 0.119
## corbic 0.191
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## ns 0.203 0.061 3.318 0.001 0.203 0.204
## nt 0.026 0.059 0.445 0.656 0.026 0.026
## nn 0.082 0.064 1.293 0.196 0.082 0.081
## na 0.269 0.064 4.219 0.000 0.269 0.267
## cb 0.007 0.062 0.120 0.905 0.007 0.008
## cs 0.285 0.061 4.690 0.000 0.285 0.285
## ct 0.114 0.059 1.927 0.054 0.114 0.113
## ca 0.120 0.062 1.955 0.051 0.120 0.119
## lb 0.072 0.066 1.087 0.277 0.072 0.070
## ls 0.315 0.058 5.477 0.000 0.315 0.318
## la 0.217 0.055 3.916 0.000 0.217 0.216
#modificationindices(modfitW, sort=T, maximum.number=20)
#residuals(modfitW)
labelsfarwest=createLabels(modfitFW, cnameslag)
labelswest=createLabels(modfitW, cnameslag)
labelsnorth=createLabels(modfitN, cnameslag)
labelssouth=createLabels(modfitS, cnameslag)
#Extract model coefficients for table
coef_table<-bind_rows(coef_table, coef_tabler(modfitFW, modfitW, modfitN, modfitS, name="Lower trophic level aggregates"))
#FAR WEST
# myLavaanPlot(model=modfitFW, labels=labelsfarwest,
# node_options=list(shape="box", fontname="Helvetica"),
# coefs=TRUE, stand=TRUE, covs=FALSE, sig=0.05,
# width=c("regress","latent"),
# color=c("regress","latent"))
lower_plot_far_west <- createGraph(fit=modfitFW,
reference_df=cnameslag,
model_type="monthly_lower_trophic",
title="Far West",
manual_port_settings=TRUE)
lower_plot_far_west
#WEST
# myLavaanPlot(model=modfitW, labels=labelswest,
# node_options=list(shape="box", fontname="Helvetica"),
# coefs=TRUE, stand=TRUE, covs=FALSE, sig=0.05,
# width=c("regress","latent"),
# color=c("regress","latent"))
lower_plot_west <- createGraph(fit=modfitW,
reference_df=cnameslag,
model_type="monthly_lower_trophic",
title="West",
manual_port_settings=TRUE)
lower_plot_west
#NORTH
# myLavaanPlot(model=modfitN, labels=labelsnorth,
# node_options=list(shape="box", fontname="Helvetica"),
# coefs=TRUE, stand=TRUE, covs=FALSE, sig=0.05,
# width=c("regress","latent"),
# color=c("regress","latent"))
lower_plot_north <- createGraph(fit=modfitN,
reference_df=cnameslag,
model_type="monthly_lower_trophic",
title="North",
manual_port_settings=TRUE)
lower_plot_north
#SOUTH
# myLavaanPlot(model=modfitS, labels=labelssouth,
# node_options=list(shape="box", fontname="Helvetica"),
# coefs=TRUE, stand=TRUE, covs=FALSE, sig=0.05,
# width=c("regress","latent"),
# color=c("regress","latent"))
lower_plot_south <- createGraph(fit=modfitS,
reference_df=cnameslag,
model_type="monthly_lower_trophic",
title="South",
manual_port_settings=TRUE)
lower_plot_south
Save updated SEM diagrams
Total effects
ssFW=standardizedsolution(modfitFW) %>% mutate(region="Far West")
ssW=standardizedsolution(modfitW) %>% mutate(region="West")
ssN=standardizedsolution(modfitN) %>% mutate(region="North")
ssS=standardizedsolution(modfitS) %>% mutate(region="South")
sslt=rbind(ssFW,ssW,ssN,ssS) %>% filter(op==":=") %>% select(region,lhs,est.std:ci.upper) %>%
separate(lhs,c("variable","influence"), sep=1) %>%
mutate(variable=case_when(variable=="n" ~ "DIN",
variable=="c" ~ "phytoplankton",
variable=="l" ~ "clams"),
influence=case_when(influence=="b" ~ "bottom-up",
influence=="t" ~ "top-down",
influence=="s" ~ "self-regulation",
influence=="a" ~ "abiotic drivers",
influence=="n" ~ "nutrient cycling"),
region=factor(region, levels=regionorder),
influence=factor(influence, levels=c("self-regulation","bottom-up","top-down","abiotic drivers","nutrient cycling")),
variable=factor(variable,levels=c("clams","phytoplankton","DIN")),
sig=ifelse(pvalue<0.05,"*",""))
ggplot(sslt,aes(x=influence,y=est.std)) +
facet_grid(variable~region) +
geom_errorbar(aes(ymin=ci.lower, ymax=ci.upper),width=0.5) +
geom_point() +
geom_text(aes(y=ci.upper+0.05, label=sig)) +
geom_hline(yintercept = 0) +
theme_bw() + theme(axis.text.x=element_text(angle=90, vjust=0.5, hjust=1)) +
labs(y="total effect (standardized)")
ggsave("./fig_output/lteffects.png",width = 6,height=5)
#1
# modFW='chla~chla_1+hcope_1+amphi_m_1+potam_1+flow+turbid+temp
# hcope~chla_1+hcope_1+pcope_1+potam_1+flow+turbid+temp+estfish_bsmt_1
# amphi_m~chla_1+amphi_m_1+flow+turbid+temp+estfish_bsmt_1
# pcope~hcope_1+pcope_1+potam_1+flow+turbid+temp+estfish_bsmt_1
# '
# modW='chla~chla_1+hcope_1+amphi_m_1+potam_1+flow+turbid+temp+mysid_1
# hcope~chla_1+hcope_1+pcope_1+mysid_1+potam_1+flow+turbid+temp+estfish_bsmt_1
# amphi_m~chla_1+amphi_m_1+mysid_1+flow+turbid+temp+estfish_bsmt_1
# pcope~hcope_1+pcope_1+mysid_1+potam_1+flow+turbid+temp+estfish_bsmt_1
# mysid~chla_1+hcope_1+pcope_1+amphi_m_1+mysid_1+flow+turbid+temp+estfish_bsmt_1
# '
# modN='chla~chla_1+hcope_1+amphi_m_1+corbic_1+flow+turbid+temp
# hcope~chla_1+hcope_1+pcope_1+mysid_1+corbic_1+flow+turbid+temp+estfish_bsmt_1
# amphi_m~chla_1+amphi_m_1+flow+turbid+temp+estfish_bsmt_1
# pcope~hcope_1+pcope_1+mysid_1+corbic_1+flow+turbid+temp+estfish_bsmt_1
# mysid~hcope_1+pcope_1+mysid_1+amphi_m_1+flow+turbid+temp+estfish_bsmt_1
# '
# modS='chla~chla_1+hcope_1+clad_1+corbic_1+flow+turbid+temp
# hcope~chla_1+hcope_1+pcope_1+corbic_1+flow+turbid+temp+estfish_bsmt_1
# clad~chla_1+clad_1+pcope_1+flow+turbid+temp+estfish_bsmt_1
# amphi_m~chla_1+amphi_m_1+flow+turbid+temp+estfish_bsmt_1
# pcope~chla_1+hcope_1+clad_1+pcope_1+corbic_1+flow+turbid+temp+estfish_bsmt_1
# '
#2
modFW='chla~chla_1+hcope_1+amphi_m_1+rotif_m_1+potam_1+flow+turbid+temp
hcope~chla_1+hcope_1+pcope_1+potam_1+flow+turbid+temp+estfish_bsmt_1
amphi_m~chla_1+amphi_m_1+flow+turbid+temp+estfish_bsmt_1
rotif_m~chla_1+rotif_m_1+flow+turbid+temp+estfish_bsmt_1
pcope~hcope_1+pcope_1+potam_1+flow+turbid+temp+estfish_bsmt_1
'
modW='chla~chla_1+hcope_1+amphi_m_1+rotif_m_1+potam_1+flow+turbid+temp+mysid_1
hcope~chla_1+hcope_1+pcope_1+mysid_1+potam_1+flow+turbid+temp+estfish_bsmt_1+rotif_m_1
amphi_m~chla_1+amphi_m_1+mysid_1+flow+turbid+temp+estfish_bsmt_1
rotif_m~chla_1+rotif_m_1+flow+turbid+temp+estfish_bsmt_1
pcope~hcope_1+pcope_1+mysid_1+potam_1+flow+turbid+temp+estfish_bsmt_1+rotif_m_1
mysid~chla_1+hcope_1+pcope_1+amphi_m_1+mysid_1+flow+turbid+temp+estfish_bsmt_1
'
modN='chla~chla_1+hcope_1+clad_1+amphi_m_1+rotif_m_1+corbic_1+flow+turbid+temp
hcope~chla_1+hcope_1+pcope_1+mysid_1+corbic_1+flow+turbid+temp+estfish_bsmt_1
clad~chla_1+clad_1+pcope_1+flow+turbid+temp+estfish_bsmt_1
amphi_m~chla_1+amphi_m_1+flow+turbid+temp+estfish_bsmt_1
rotif_m~chla_1+rotif_m_1+flow+turbid+temp+estfish_bsmt_1
pcope~hcope_1+pcope_1+clad_1+mysid_1+corbic_1+flow+turbid+temp+estfish_bsmt_1+chla_1
mysid~hcope_1+pcope_1+mysid_1+amphi_m_1+flow+turbid+temp+estfish_bsmt_1
'
modS='chla~chla_1+hcope_1+clad_1+rotif_m_1+corbic_1+flow+turbid+temp
hcope~chla_1+hcope_1+pcope_1+corbic_1+flow+turbid+temp+estfish_bsmt_1
clad~chla_1+clad_1+pcope_1+flow+turbid+temp+estfish_bsmt_1
amphi_m~chla_1+amphi_m_1+flow+turbid+temp+estfish_bsmt_1
rotif_m~chla_1+rotif_m_1+flow+turbid+temp+estfish_bsmt_1
pcope~chla_1+hcope_1+clad_1+pcope_1+corbic_1+flow+turbid+temp+estfish_bsmt_1
'
modfitFW=sem(modFW, data=filter(fdr_ds,region=="Far West"))
modfitW=sem(modW, data=filter(fdr_ds,region=="West"))
modfitN=sem(modN, data=filter(fdr_ds,region=="North"))
modfitS=sem(modS, data=filter(fdr_ds,region=="South"))
summary(modfitFW, standardized=T, rsq=T)
## lavaan 0.6-11 ended normally after 26 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 50
##
## Used Total
## Number of observations 192 312
##
## Model Test User Model:
##
## Test statistic 18.154
## Degrees of freedom 15
## P-value (Chi-square) 0.255
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## chla ~
## chla_1 0.208 0.068 3.065 0.002 0.208 0.212
## hcope_1 0.066 0.055 1.199 0.230 0.066 0.084
## amphi_m_1 0.026 0.067 0.383 0.702 0.026 0.032
## rotif_m_1 -0.069 0.063 -1.096 0.273 -0.069 -0.080
## potam_1 -0.003 0.050 -0.064 0.949 -0.003 -0.004
## flow 0.121 0.073 1.674 0.094 0.121 0.144
## turbid -0.078 0.069 -1.131 0.258 -0.078 -0.088
## temp 0.138 0.062 2.238 0.025 0.138 0.161
## hcope ~
## chla_1 0.106 0.082 1.297 0.195 0.106 0.085
## hcope_1 0.234 0.070 3.317 0.001 0.234 0.234
## pcope_1 0.066 0.072 0.915 0.360 0.066 0.064
## potam_1 -0.146 0.063 -2.296 0.022 -0.146 -0.158
## flow -0.073 0.083 -0.882 0.378 -0.073 -0.068
## turbid -0.016 0.084 -0.185 0.853 -0.016 -0.014
## temp -0.055 0.077 -0.714 0.475 -0.055 -0.050
## estfish_bsmt_1 -0.133 0.076 -1.744 0.081 -0.133 -0.130
## amphi_m ~
## chla_1 0.051 0.039 1.293 0.196 0.051 0.042
## amphi_m_1 0.730 0.038 19.451 0.000 0.730 0.745
## flow -0.261 0.042 -6.188 0.000 -0.261 -0.248
## turbid -0.011 0.040 -0.290 0.772 -0.011 -0.010
## temp 0.014 0.036 0.385 0.700 0.014 0.013
## estfish_bsmt_1 0.042 0.034 1.214 0.225 0.042 0.042
## rotif_m ~
## chla_1 -0.198 0.075 -2.635 0.008 -0.198 -0.173
## rotif_m_1 0.382 0.066 5.764 0.000 0.382 0.379
## flow 0.102 0.074 1.372 0.170 0.102 0.103
## turbid 0.007 0.076 0.099 0.922 0.007 0.007
## temp 0.055 0.069 0.799 0.424 0.055 0.055
## estfish_bsmt_1 0.008 0.065 0.130 0.897 0.008 0.009
## pcope ~
## hcope_1 0.044 0.065 0.680 0.497 0.044 0.047
## pcope_1 0.299 0.067 4.464 0.000 0.299 0.303
## potam_1 -0.093 0.059 -1.580 0.114 -0.093 -0.105
## flow 0.206 0.076 2.704 0.007 0.206 0.201
## turbid 0.087 0.078 1.115 0.265 0.087 0.081
## temp 0.159 0.072 2.220 0.026 0.159 0.152
## estfish_bsmt_1 -0.007 0.070 -0.096 0.923 -0.007 -0.007
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla ~~
## .hcope 0.036 0.054 0.669 0.504 0.036 0.048
## .amphi_m 0.017 0.025 0.689 0.491 0.017 0.050
## .rotif_m 0.071 0.048 1.469 0.142 0.071 0.107
## .pcope -0.006 0.050 -0.126 0.900 -0.006 -0.009
## .hcope ~~
## .amphi_m -0.012 0.031 -0.387 0.699 -0.012 -0.028
## .rotif_m 0.037 0.060 0.618 0.537 0.037 0.045
## .pcope -0.202 0.063 -3.193 0.001 -0.202 -0.237
## .amphi_m ~~
## .rotif_m -0.032 0.028 -1.131 0.258 -0.032 -0.082
## .pcope -0.008 0.029 -0.272 0.785 -0.008 -0.020
## .rotif_m ~~
## .pcope 0.049 0.055 0.884 0.377 0.049 0.064
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla 0.600 0.061 9.798 0.000 0.600 0.892
## .hcope 0.923 0.094 9.798 0.000 0.923 0.850
## .amphi_m 0.201 0.021 9.798 0.000 0.201 0.193
## .rotif_m 0.741 0.076 9.798 0.000 0.741 0.807
## .pcope 0.792 0.081 9.798 0.000 0.792 0.801
##
## R-Square:
## Estimate
## chla 0.108
## hcope 0.150
## amphi_m 0.807
## rotif_m 0.193
## pcope 0.199
summary(modfitW, standardized=T, rsq=T)
## lavaan 0.6-11 ended normally after 27 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 71
##
## Used Total
## Number of observations 215 312
##
## Model Test User Model:
##
## Test statistic 28.044
## Degrees of freedom 16
## P-value (Chi-square) 0.031
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## chla ~
## chla_1 0.155 0.068 2.281 0.023 0.155 0.157
## hcope_1 0.058 0.064 0.898 0.369 0.058 0.063
## amphi_m_1 0.139 0.061 2.279 0.023 0.139 0.161
## rotif_m_1 0.087 0.057 1.514 0.130 0.087 0.103
## potam_1 -0.049 0.066 -0.748 0.455 -0.049 -0.055
## flow 0.068 0.067 1.003 0.316 0.068 0.072
## turbid 0.074 0.068 1.084 0.278 0.074 0.080
## temp -0.095 0.059 -1.606 0.108 -0.095 -0.106
## mysid_1 -0.157 0.065 -2.430 0.015 -0.157 -0.172
## hcope ~
## chla_1 0.048 0.070 0.683 0.494 0.048 0.045
## hcope_1 0.306 0.068 4.482 0.000 0.306 0.307
## pcope_1 -0.096 0.060 -1.591 0.112 -0.096 -0.102
## mysid_1 0.048 0.070 0.687 0.492 0.048 0.049
## potam_1 -0.166 0.065 -2.531 0.011 -0.166 -0.172
## flow -0.137 0.071 -1.933 0.053 -0.137 -0.135
## turbid -0.119 0.071 -1.673 0.094 -0.119 -0.119
## temp 0.063 0.062 1.017 0.309 0.063 0.065
## estfish_bsmt_1 0.048 0.060 0.807 0.420 0.048 0.051
## rotif_m_1 0.173 0.059 2.938 0.003 0.173 0.190
## amphi_m ~
## chla_1 -0.047 0.041 -1.154 0.248 -0.047 -0.041
## amphi_m_1 0.783 0.038 20.620 0.000 0.783 0.787
## mysid_1 0.080 0.039 2.074 0.038 0.080 0.076
## flow 0.008 0.040 0.196 0.844 0.008 0.007
## turbid -0.109 0.041 -2.632 0.008 -0.109 -0.103
## temp -0.103 0.037 -2.790 0.005 -0.103 -0.099
## estfish_bsmt_1 -0.177 0.037 -4.761 0.000 -0.177 -0.176
## rotif_m ~
## chla_1 0.038 0.072 0.527 0.598 0.038 0.032
## rotif_m_1 0.333 0.063 5.303 0.000 0.333 0.332
## flow 0.239 0.072 3.307 0.001 0.239 0.214
## turbid -0.105 0.070 -1.495 0.135 -0.105 -0.095
## temp 0.032 0.065 0.491 0.623 0.032 0.030
## estfish_bsmt_1 -0.189 0.062 -3.062 0.002 -0.189 -0.182
## pcope ~
## hcope_1 -0.130 0.060 -2.167 0.030 -0.130 -0.125
## pcope_1 0.393 0.055 7.137 0.000 0.393 0.405
## mysid_1 0.118 0.063 1.864 0.062 0.118 0.115
## potam_1 0.046 0.061 0.762 0.446 0.046 0.046
## flow 0.138 0.064 2.163 0.031 0.138 0.131
## turbid -0.144 0.065 -2.225 0.026 -0.144 -0.138
## temp 0.229 0.055 4.133 0.000 0.229 0.227
## estfish_bsmt_1 0.026 0.056 0.470 0.639 0.026 0.027
## rotif_m_1 0.161 0.054 2.988 0.003 0.161 0.169
## mysid ~
## chla_1 0.181 0.062 2.910 0.004 0.181 0.169
## hcope_1 0.073 0.060 1.217 0.224 0.073 0.073
## pcope_1 0.110 0.053 2.054 0.040 0.110 0.116
## amphi_m_1 -0.123 0.056 -2.197 0.028 -0.123 -0.131
## mysid_1 0.372 0.063 5.929 0.000 0.372 0.373
## flow -0.168 0.060 -2.788 0.005 -0.168 -0.165
## turbid 0.257 0.064 4.032 0.000 0.257 0.255
## temp 0.097 0.055 1.755 0.079 0.097 0.100
## estfish_bsmt_1 -0.023 0.056 -0.423 0.673 -0.023 -0.025
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla ~~
## .hcope 0.150 0.050 3.019 0.003 0.150 0.210
## .amphi_m -0.002 0.029 -0.056 0.956 -0.002 -0.004
## .rotif_m 0.125 0.052 2.386 0.017 0.125 0.165
## .pcope 0.015 0.044 0.337 0.736 0.015 0.023
## .mysid 0.078 0.044 1.788 0.074 0.078 0.123
## .hcope ~~
## .amphi_m -0.036 0.030 -1.195 0.232 -0.036 -0.082
## .rotif_m -0.015 0.054 -0.276 0.782 -0.015 -0.019
## .pcope 0.080 0.046 1.718 0.086 0.080 0.118
## .mysid 0.204 0.048 4.285 0.000 0.204 0.306
## .amphi_m ~~
## .rotif_m 0.043 0.032 1.328 0.184 0.043 0.091
## .pcope 0.068 0.028 2.438 0.015 0.068 0.169
## .mysid -0.039 0.027 -1.420 0.156 -0.039 -0.097
## .rotif_m ~~
## .pcope 0.068 0.049 1.386 0.166 0.068 0.095
## .mysid 0.029 0.048 0.598 0.550 0.029 0.041
## .pcope ~~
## .mysid 0.056 0.041 1.344 0.179 0.056 0.092
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla 0.682 0.066 10.368 0.000 0.682 0.845
## .hcope 0.747 0.072 10.368 0.000 0.747 0.791
## .amphi_m 0.266 0.026 10.368 0.000 0.266 0.249
## .rotif_m 0.838 0.081 10.368 0.000 0.838 0.735
## .pcope 0.613 0.059 10.368 0.000 0.613 0.599
## .mysid 0.598 0.058 10.368 0.000 0.598 0.625
##
## R-Square:
## Estimate
## chla 0.155
## hcope 0.209
## amphi_m 0.751
## rotif_m 0.265
## pcope 0.401
## mysid 0.375
summary(modfitN, standardized=T, rsq=T)
## lavaan 0.6-11 ended normally after 31 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 83
##
## Used Total
## Number of observations 205 312
##
## Model Test User Model:
##
## Test statistic 35.639
## Degrees of freedom 29
## P-value (Chi-square) 0.184
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## chla ~
## chla_1 0.168 0.074 2.267 0.023 0.168 0.155
## hcope_1 -0.017 0.092 -0.180 0.857 -0.017 -0.014
## clad_1 0.188 0.078 2.424 0.015 0.188 0.185
## amphi_m_1 0.063 0.072 0.868 0.385 0.063 0.059
## rotif_m_1 -0.040 0.070 -0.569 0.569 -0.040 -0.041
## corbic_1 -0.026 0.071 -0.368 0.713 -0.026 -0.025
## flow -0.034 0.079 -0.435 0.663 -0.034 -0.033
## turbid 0.095 0.071 1.332 0.183 0.095 0.095
## temp 0.119 0.070 1.701 0.089 0.119 0.120
## hcope ~
## chla_1 -0.009 0.043 -0.212 0.832 -0.009 -0.011
## hcope_1 0.121 0.068 1.778 0.075 0.121 0.128
## pcope_1 -0.095 0.043 -2.198 0.028 -0.095 -0.131
## mysid_1 0.046 0.060 0.767 0.443 0.046 0.058
## corbic_1 0.102 0.042 2.433 0.015 0.102 0.125
## flow -0.394 0.049 -8.053 0.000 -0.394 -0.498
## turbid 0.089 0.047 1.888 0.059 0.089 0.115
## temp 0.097 0.044 2.220 0.026 0.097 0.127
## estfish_bsmt_1 0.007 0.044 0.167 0.867 0.007 0.010
## clad ~
## chla_1 -0.037 0.062 -0.600 0.549 -0.037 -0.033
## clad_1 0.377 0.063 6.024 0.000 0.377 0.356
## pcope_1 0.016 0.057 0.275 0.783 0.016 0.016
## flow 0.457 0.067 6.794 0.000 0.457 0.428
## turbid 0.003 0.062 0.056 0.955 0.003 0.003
## temp 0.051 0.058 0.882 0.378 0.051 0.050
## estfish_bsmt_1 0.019 0.058 0.333 0.739 0.019 0.020
## amphi_m ~
## chla_1 0.059 0.058 1.011 0.312 0.059 0.060
## amphi_m_1 0.499 0.057 8.740 0.000 0.499 0.514
## flow 0.053 0.061 0.863 0.388 0.053 0.056
## turbid -0.020 0.056 -0.346 0.730 -0.020 -0.021
## temp -0.039 0.055 -0.710 0.477 -0.039 -0.043
## estfish_bsmt_1 -0.068 0.055 -1.227 0.220 -0.068 -0.079
## rotif_m ~
## chla_1 -0.089 0.070 -1.281 0.200 -0.089 -0.079
## rotif_m_1 0.155 0.064 2.426 0.015 0.155 0.152
## flow 0.405 0.073 5.531 0.000 0.405 0.381
## turbid -0.052 0.067 -0.777 0.437 -0.052 -0.050
## temp -0.076 0.065 -1.164 0.244 -0.076 -0.074
## estfish_bsmt_1 -0.015 0.065 -0.225 0.822 -0.015 -0.015
## pcope ~
## hcope_1 -0.146 0.102 -1.431 0.153 -0.146 -0.115
## pcope_1 0.251 0.065 3.885 0.000 0.251 0.256
## clad_1 -0.134 0.070 -1.909 0.056 -0.134 -0.128
## mysid_1 0.064 0.090 0.708 0.479 0.064 0.060
## corbic_1 0.064 0.066 0.967 0.333 0.064 0.059
## flow -0.193 0.076 -2.542 0.011 -0.193 -0.182
## turbid -0.244 0.071 -3.439 0.001 -0.244 -0.235
## temp 0.072 0.066 1.094 0.274 0.072 0.071
## estfish_bsmt_1 -0.063 0.067 -0.943 0.346 -0.063 -0.064
## chla_1 0.153 0.070 2.197 0.028 0.153 0.137
## mysid ~
## hcope_1 -0.021 0.084 -0.253 0.800 -0.021 -0.018
## pcope_1 -0.061 0.054 -1.132 0.258 -0.061 -0.067
## mysid_1 0.173 0.073 2.360 0.018 0.173 0.175
## amphi_m_1 -0.081 0.052 -1.565 0.118 -0.081 -0.080
## flow -0.420 0.062 -6.785 0.000 -0.420 -0.427
## turbid 0.228 0.060 3.809 0.000 0.228 0.236
## temp 0.081 0.054 1.483 0.138 0.081 0.085
## estfish_bsmt_1 0.056 0.056 1.011 0.312 0.056 0.062
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla ~~
## .hcope 0.022 0.040 0.543 0.587 0.022 0.038
## .clad 0.140 0.056 2.521 0.012 0.140 0.179
## .amphi_m 0.018 0.052 0.355 0.723 0.018 0.025
## .rotif_m 0.098 0.062 1.582 0.114 0.098 0.111
## .pcope -0.058 0.061 -0.959 0.338 -0.058 -0.067
## .mysid 0.084 0.051 1.636 0.102 0.084 0.115
## .hcope ~~
## .clad -0.059 0.035 -1.722 0.085 -0.059 -0.121
## .amphi_m 0.039 0.033 1.183 0.237 0.039 0.083
## .rotif_m -0.007 0.038 -0.191 0.849 -0.007 -0.013
## .pcope 0.060 0.038 1.563 0.118 0.060 0.110
## .mysid 0.180 0.034 5.257 0.000 0.180 0.395
## .clad ~~
## .amphi_m 0.004 0.044 0.088 0.930 0.004 0.006
## .rotif_m 0.107 0.053 2.016 0.044 0.107 0.142
## .pcope -0.051 0.052 -0.991 0.322 -0.051 -0.069
## .mysid -0.083 0.044 -1.899 0.058 -0.083 -0.134
## .amphi_m ~~
## .rotif_m -0.128 0.051 -2.529 0.011 -0.128 -0.179
## .pcope -0.088 0.049 -1.777 0.076 -0.088 -0.125
## .mysid 0.088 0.042 2.103 0.035 0.088 0.148
## .rotif_m ~~
## .pcope 0.150 0.059 2.552 0.011 0.150 0.181
## .mysid 0.002 0.049 0.045 0.964 0.002 0.003
## .pcope ~~
## .mysid 0.135 0.049 2.757 0.006 0.135 0.196
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla 0.921 0.091 10.124 0.000 0.921 0.908
## .hcope 0.360 0.036 10.124 0.000 0.360 0.595
## .clad 0.669 0.066 10.124 0.000 0.669 0.608
## .amphi_m 0.603 0.060 10.124 0.000 0.603 0.713
## .rotif_m 0.842 0.083 10.124 0.000 0.842 0.773
## .pcope 0.819 0.081 10.124 0.000 0.819 0.755
## .mysid 0.577 0.057 10.124 0.000 0.577 0.619
##
## R-Square:
## Estimate
## chla 0.092
## hcope 0.405
## clad 0.392
## amphi_m 0.287
## rotif_m 0.227
## pcope 0.245
## mysid 0.381
summary(modfitS, standardized=T, rsq=T)
## lavaan 0.6-11 ended normally after 19 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 65
##
## Used Total
## Number of observations 210 312
##
## Model Test User Model:
##
## Test statistic 24.647
## Degrees of freedom 22
## P-value (Chi-square) 0.314
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## chla ~
## chla_1 0.227 0.070 3.227 0.001 0.227 0.220
## hcope_1 0.116 0.068 1.706 0.088 0.116 0.109
## clad_1 0.177 0.067 2.633 0.008 0.177 0.181
## rotif_m_1 -0.074 0.068 -1.088 0.277 -0.074 -0.069
## corbic_1 -0.008 0.065 -0.126 0.900 -0.008 -0.008
## flow -0.076 0.074 -1.018 0.309 -0.076 -0.069
## turbid 0.016 0.067 0.243 0.808 0.016 0.016
## temp 0.073 0.066 1.114 0.265 0.073 0.072
## hcope ~
## chla_1 0.159 0.058 2.763 0.006 0.159 0.163
## hcope_1 0.357 0.061 5.834 0.000 0.357 0.355
## pcope_1 0.001 0.056 0.012 0.991 0.001 0.001
## corbic_1 0.114 0.058 1.975 0.048 0.114 0.117
## flow -0.143 0.063 -2.280 0.023 -0.143 -0.139
## turbid -0.093 0.058 -1.614 0.106 -0.093 -0.098
## temp 0.179 0.057 3.128 0.002 0.179 0.187
## estfish_bsmt_1 -0.182 0.058 -3.144 0.002 -0.182 -0.189
## clad ~
## chla_1 0.143 0.059 2.430 0.015 0.143 0.137
## clad_1 0.516 0.058 8.883 0.000 0.516 0.517
## pcope_1 -0.028 0.053 -0.519 0.604 -0.028 -0.028
## flow 0.200 0.061 3.282 0.001 0.200 0.181
## turbid -0.050 0.057 -0.873 0.382 -0.050 -0.049
## temp 0.110 0.056 1.953 0.051 0.110 0.107
## estfish_bsmt_1 -0.093 0.055 -1.690 0.091 -0.093 -0.090
## amphi_m ~
## chla_1 -0.057 0.071 -0.808 0.419 -0.057 -0.053
## amphi_m_1 0.218 0.068 3.202 0.001 0.218 0.214
## flow -0.008 0.075 -0.101 0.920 -0.008 -0.007
## turbid 0.169 0.071 2.370 0.018 0.169 0.162
## temp 0.092 0.070 1.301 0.193 0.092 0.087
## estfish_bsmt_1 0.049 0.072 0.687 0.492 0.049 0.047
## rotif_m ~
## chla_1 0.036 0.065 0.553 0.580 0.036 0.036
## rotif_m_1 0.119 0.066 1.793 0.073 0.119 0.115
## flow 0.323 0.070 4.611 0.000 0.323 0.304
## turbid -0.071 0.064 -1.102 0.270 -0.071 -0.072
## temp 0.001 0.065 0.021 0.983 0.001 0.001
## estfish_bsmt_1 0.171 0.065 2.614 0.009 0.171 0.173
## pcope ~
## chla_1 0.237 0.065 3.639 0.000 0.237 0.225
## hcope_1 -0.059 0.064 -0.926 0.355 -0.059 -0.055
## clad_1 0.071 0.063 1.133 0.257 0.071 0.071
## pcope_1 0.443 0.060 7.356 0.000 0.443 0.444
## corbic_1 -0.054 0.061 -0.886 0.376 -0.054 -0.051
## flow 0.033 0.069 0.472 0.637 0.033 0.029
## turbid -0.080 0.063 -1.257 0.209 -0.080 -0.078
## temp 0.011 0.062 0.181 0.856 0.011 0.011
## estfish_bsmt_1 -0.051 0.063 -0.811 0.418 -0.051 -0.049
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla ~~
## .hcope 0.091 0.052 1.742 0.082 0.091 0.121
## .clad 0.212 0.053 3.980 0.000 0.212 0.286
## .amphi_m 0.004 0.064 0.064 0.949 0.004 0.004
## .rotif_m 0.122 0.060 2.044 0.041 0.122 0.142
## .pcope -0.018 0.056 -0.324 0.746 -0.018 -0.022
## .hcope ~~
## .clad 0.046 0.044 1.060 0.289 0.046 0.073
## .amphi_m 0.026 0.055 0.478 0.633 0.026 0.033
## .rotif_m 0.015 0.051 0.288 0.773 0.015 0.020
## .pcope 0.027 0.048 0.566 0.571 0.027 0.039
## .clad ~~
## .amphi_m -0.095 0.055 -1.734 0.083 -0.095 -0.120
## .rotif_m 0.032 0.050 0.630 0.528 0.032 0.044
## .pcope 0.082 0.048 1.728 0.084 0.082 0.120
## .amphi_m ~~
## .rotif_m 0.059 0.063 0.942 0.346 0.059 0.065
## .pcope 0.035 0.060 0.588 0.556 0.035 0.041
## .rotif_m ~~
## .pcope 0.199 0.057 3.512 0.000 0.199 0.250
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla 0.880 0.086 10.247 0.000 0.880 0.862
## .hcope 0.642 0.063 10.247 0.000 0.642 0.703
## .clad 0.625 0.061 10.247 0.000 0.625 0.593
## .amphi_m 0.989 0.097 10.247 0.000 0.989 0.903
## .rotif_m 0.838 0.082 10.247 0.000 0.838 0.866
## .pcope 0.754 0.074 10.247 0.000 0.754 0.710
##
## R-Square:
## Estimate
## chla 0.138
## hcope 0.297
## clad 0.407
## amphi_m 0.097
## rotif_m 0.134
## pcope 0.290
#modificationindices(modfitW, sort=T, maximum.number=20)
#residuals(modfitW)
labelsfarwest=createLabels(modfitFW, cnameslag)
labelswest=createLabels(modfitW, cnameslag)
labelsnorth=createLabels(modfitN, cnameslag)
labelssouth=createLabels(modfitS, cnameslag)
#Extract model coefficients for table
coef_table<-bind_rows(coef_table, coef_tabler(modfitFW, modfitW, modfitN, modfitS, name="Individual zooplankton groups"))
write.csv(coef_table, "fig_output/monthly coefficients.csv", row.names = FALSE)
#FAR WEST
# myLavaanPlot(model=modfitFW, labels=labelsfarwest,
# node_options=list(shape="box", fontname="Helvetica"),
# coefs=TRUE, stand=TRUE, covs=FALSE, sig=0.05,
# width=c("regress","latent"),
# color=c("regress","latent"))
zoop_plot_far_west <- createGraph(fit=modfitFW,
reference_df=cnameslag,
model_type="monthly_zoop",
region="Far West",
title="Far West",
manual_port_settings=TRUE)
zoop_plot_far_west
#WEST
# myLavaanPlot(model=modfitW, labels=labelswest,
# node_options=list(shape="box", fontname="Helvetica"),
# coefs=TRUE, stand=TRUE, covs=FALSE, sig=0.05,
# width=c("regress","latent"),
# color=c("regress","latent"))
zoop_plot_west <- createGraph(fit=modfitW,
reference_df=cnameslag,
model_type="monthly_zoop",
region="West",
title="West",
manual_port_settings=TRUE)
zoop_plot_west
#NORTH
# myLavaanPlot(model=modfitN, labels=labelsnorth,
# node_options=list(shape="box", fontname="Helvetica"),
# coefs=TRUE, stand=TRUE, covs=FALSE, sig=0.05,
# width=c("regress","latent"),
# color=c("regress","latent"))
zoop_plot_north <- createGraph(fit=modfitN,
reference_df=cnameslag,
model_type="monthly_zoop",
region="North",
title="North",
manual_port_settings=TRUE)
zoop_plot_north
#SOUTH
# myLavaanPlot(model=modfitS, labels=labelssouth,
# node_options=list(shape="box", fontname="Helvetica"),
# coefs=TRUE, stand=TRUE, covs=FALSE, sig=0.05,
# width=c("regress","latent"),
# color=c("regress","latent"))
zoop_plot_south <- createGraph(fit=modfitS,
reference_df=cnameslag,
model_type="monthly_zoop",
region="South",
title="South",
manual_port_settings=TRUE)
zoop_plot_south
Save updated SEM diagrams
zoop_grobs <- map(list(zoop_plot_far_west,
zoop_plot_west,
zoop_plot_north,
zoop_plot_south), ~convert_html_to_grob(.x, 2000))
zoop_figure <- ggarrange(plotlist=zoop_grobs, labels="auto",
font.label=list(size=11)) %>%
annotate_figure(top = text_grob("Monthly Regional Models (zooplankton groups)",
color = "black",
face = "bold",
size = 11))
ggsave('./fig_output/sem_zoop.png',zoop_figure, width=8, height=7, dpi=300, bg = "white")
Total effects
Haven’t done yet.
modFW='hzoop_gr~hb1*chla_1+hs1*hzoop_1+ht1*pzoop_1+ht2*potam_1+ht3*estfish_bsmt_1+ha1*flow+ha2*temp+ha3*turbid
pzoop_gr~pb1*hzoop_1+ps1*pzoop_1+pt1*potam_1+pt2*estfish_bsmt_1+pa1*flow+pa2*temp+pa3*turbid
estfish_bsmt_gr~fb1*hzoop_1+fb2*pzoop_1+fs1*estfish_bsmt_1+fa1*flow+fa2*temp+fa3*turbid+ft1*marfish_bsmt_1+ft2*sbass1_bsmt_1
hb:=sqrt(hb1^2)
hs:=sqrt(hs1^2)
ht:=sqrt(ht1^2+ht2^2+ht3^2)
ha:=sqrt(ha1^2+ha2^2+ha3^2)
pb:=sqrt(pb1^2)
ps:=sqrt(ps1^2)
pt:=sqrt(pt1^2+pt2^2)
pa:=sqrt(pa1^2+pa2^2+pa3^2)
fb:=sqrt(fb1^2+fb2^2)
fs:=sqrt(fs1^2)
ft:=sqrt(ft1^2+ft2^2)
fa:=sqrt(fa1^2+fa2^2+fa3^2)
'
modW='hzoop_gr~hb1*chla_1+hs1*hzoop_1+ht1*pzoop_1+ht2*potam_1+ht3*estfish_bsmt_1+ha1*flow+ha2*temp+ha3*turbid
pzoop_gr~pb1*chla_1+pb2*hzoop_1+ps1*pzoop_1+pt1*potam_1+pt2*estfish_bsmt_1+pa1*flow+pa2*temp+pa3*turbid
estfish_bsmt_gr~fb1*hzoop_1+fb2*pzoop_1+fs1*estfish_bsmt_1+fa1*flow+fa2*temp+fa3*turbid+ft1*sbass1_bsmt_1
hb:=sqrt(hb1^2)
hs:=sqrt(hs1^2)
ht:=sqrt(ht1^2+ht2^2+ht3^2)
ha:=sqrt(ha1^2+ha2^2+ha3^2)
pb:=sqrt(pb1^2+pb2^2)
ps:=sqrt(ps1^2)
pt:=sqrt(pt1^2+pt2^2)
pa:=sqrt(pa1^2+pa2^2+pa3^2)
fb:=sqrt(fb1^2+fb2^2)
fs:=sqrt(fs1^2)
ft:=sqrt(ft1^2)
fa:=sqrt(fa1^2+fa2^2+fa3^2)
'
modN='hzoop_gr~hb1*chla_1+hs1*hzoop_1+ht1*pzoop_1+ht2*corbic_1+ht3*estfish_bsmt_1+ha1*flow+ha2*temp+ha3*turbid
pzoop_gr~pb1*chla_1+pb2*hzoop_1+ps1*pzoop_1+pt1*corbic_1+pt2*estfish_bsmt_1+pa1*flow+pa2*temp+pa3*turbid
estfish_bsmt_gr~fb1*hzoop_1+fb2*pzoop_1+fs1*estfish_bsmt_1+fa1*flow+fa2*temp+fa3*turbid+ft1*sside_1+ft2*cent_1+ft3*sbass1_bsmt_1
hb:=sqrt(hb1^2)
hs:=sqrt(hs1^2)
ht:=sqrt(ht1^2+ht2^2+ht3^2)
ha:=sqrt(ha1^2+ha2^2+ha3^2)
pb:=sqrt(pb1^2+pb2^2)
ps:=sqrt(ps1^2)
pt:=sqrt(pt1^2+pt2^2)
pa:=sqrt(pa1^2+pa2^2+pa3^2)
fb:=sqrt(fb1^2+fb2^2)
fs:=sqrt(fs1^2)
ft:=sqrt(ft1^2+ft2^2+ft3^2)
fa:=sqrt(fa1^2+fa2^2+fa3^2)
'
modS='hzoop_gr~hb1*chla_1+hs1*hzoop_1+ht1*pzoop_1+ht2*corbic_1+ht3*estfish_bsmt_1+ha1*flow+ha2*temp+ha3*turbid
pzoop_gr~pb1*chla_1+pb2*hzoop_1+ps1*pzoop_1+pt1*corbic_1+pt2*estfish_bsmt_1+pa1*flow+pa2*temp+pa3*turbid
estfish_bsmt_gr~fb1*chla_1+fb2*hzoop_1+fb3*pzoop_1+fs1*estfish_bsmt_1+fa1*flow+fa2*temp+fa3*turbid+ft1*sside_1+ft2*cent_1+ft3*sbass1_bsmt_1
hb:=sqrt(hb1^2)
hs:=sqrt(hs1^2)
ht:=sqrt(ht1^2+ht2^2+ht3^2)
ha:=sqrt(ha1^2+ha2^2+ha3^2)
pb:=sqrt(pb1^2+pb2^2)
ps:=sqrt(ps1^2)
pt:=sqrt(pt1^2+pt2^2)
pa:=sqrt(pa1^2+pa2^2+pa3^2)
fb:=sqrt(fb1^2+fb2^2+fb3^2)
fs:=sqrt(fs1^2)
ft:=sqrt(ft1^2+ft2^2+ft3^2)
fa:=sqrt(fa1^2+fa2^2+fa3^2)
'
modfitFW=sem(modFW, data=filter(fdr_ds,region=="Far West"))
modfitW=sem(modW, data=filter(fdr_ds,region=="West"))
modfitN=sem(modN, data=filter(fdr_ds,region=="North"))
modfitS=sem(modS, data=filter(fdr_ds,region=="South"))
summary(modfitFW, standardized=T, rsq=T)
## lavaan 0.6-11 ended normally after 25 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 29
##
## Used Total
## Number of observations 191 312
##
## Model Test User Model:
##
## Test statistic 6.635
## Degrees of freedom 7
## P-value (Chi-square) 0.468
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## hzoop_gr ~
## chla_1 (hb1) 0.038 0.058 0.651 0.515 0.038 0.038
## hzoop_1 (hs1) -0.502 0.050 -10.119 0.000 -0.502 -0.619
## pzoop_1 (ht1) 0.065 0.048 1.355 0.175 0.065 0.081
## potam_1 (ht2) -0.134 0.044 -3.026 0.002 -0.134 -0.180
## estfs__1 (ht3) -0.126 0.053 -2.393 0.017 -0.126 -0.150
## flow (ha1) -0.040 0.058 -0.694 0.488 -0.040 -0.046
## temp (ha2) -0.048 0.055 -0.866 0.386 -0.048 -0.054
## turbid (ha3) 0.047 0.061 0.759 0.448 0.047 0.050
## pzoop_gr ~
## hzoop_1 (pb1) 0.072 0.103 0.700 0.484 0.072 0.045
## pzoop_1 (ps1) -0.898 0.100 -9.017 0.000 -0.898 -0.568
## potam_1 (pt1) -0.180 0.092 -1.966 0.049 -0.180 -0.121
## estfs__1 (pt2) 0.017 0.110 0.150 0.881 0.017 0.010
## flow (pa1) 0.118 0.120 0.984 0.325 0.118 0.068
## temp (pa2) -0.015 0.115 -0.132 0.895 -0.015 -0.009
## turbid (pa3) 0.330 0.128 2.571 0.010 0.330 0.176
## estfish_bsmt_gr ~
## hzoop_1 (fb1) -0.409 0.133 -3.073 0.002 -0.409 -0.187
## pzoop_1 (fb2) 0.240 0.132 1.822 0.068 0.240 0.112
## estfs__1 (fs1) -1.365 0.151 -9.060 0.000 -1.365 -0.599
## flow (fa1) 0.176 0.161 1.093 0.274 0.176 0.075
## temp (fa2) -0.027 0.153 -0.179 0.858 -0.027 -0.012
## turbid (fa3) 0.474 0.172 2.764 0.006 0.474 0.187
## mrfsh__1 (ft1) -0.033 0.150 -0.218 0.828 -0.033 -0.013
## sbss1__1 (ft2) -0.042 0.152 -0.278 0.781 -0.042 -0.018
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .hzoop_gr ~~
## .pzoop_gr -0.080 0.068 -1.170 0.242 -0.080 -0.085
## .estfsh_bsmt_gr -0.049 0.089 -0.548 0.584 -0.049 -0.040
## .pzoop_gr ~~
## .estfsh_bsmt_gr -0.401 0.189 -2.120 0.034 -0.401 -0.155
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .hzoop_gr 0.451 0.046 9.772 0.000 0.451 0.625
## .pzoop_gr 1.973 0.202 9.772 0.000 1.973 0.685
## .estfsh_bsmt_gr 3.377 0.346 9.772 0.000 3.377 0.643
##
## R-Square:
## Estimate
## hzoop_gr 0.375
## pzoop_gr 0.315
## estfsh_bsmt_gr 0.357
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## hb 0.038 0.058 0.651 0.515 0.038 0.038
## hs 0.502 0.050 10.119 0.000 0.502 0.619
## ht 0.196 0.044 4.454 0.000 0.196 0.248
## ha 0.078 0.061 1.269 0.204 0.078 0.086
## pb 0.072 0.103 0.700 0.484 0.072 0.045
## ps 0.898 0.100 9.017 0.000 0.898 0.568
## pt 0.181 0.093 1.938 0.053 0.181 0.121
## pa 0.350 0.112 3.139 0.002 0.350 0.189
## fb 0.475 0.138 3.431 0.001 0.475 0.218
## fs 1.365 0.151 9.060 0.000 1.365 0.599
## ft 0.053 0.156 0.343 0.732 0.053 0.022
## fa 0.507 0.149 3.410 0.001 0.507 0.202
summary(modfitW, standardized=T, rsq=T)
## lavaan 0.6-11 ended normally after 30 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 29
##
## Used Total
## Number of observations 210 312
##
## Model Test User Model:
##
## Test statistic 2.648
## Degrees of freedom 4
## P-value (Chi-square) 0.618
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## hzoop_gr ~
## chla_1 (hb1) 0.050 0.036 1.393 0.164 0.050 0.088
## hzoop_1 (hs1) -0.299 0.039 -7.770 0.000 -0.299 -0.566
## pzoop_1 (ht1) 0.024 0.035 0.689 0.491 0.024 0.045
## potam_1 (ht2) -0.120 0.037 -3.276 0.001 -0.120 -0.218
## estfs__1 (ht3) -0.010 0.034 -0.303 0.762 -0.010 -0.019
## flow (ha1) 0.076 0.038 2.007 0.045 0.076 0.138
## temp (ha2) 0.000 0.033 0.006 0.995 0.000 0.000
## turbid (ha3) -0.110 0.037 -2.987 0.003 -0.110 -0.198
## pzoop_gr ~
## chla_1 (pb1) 0.176 0.054 3.278 0.001 0.176 0.209
## hzoop_1 (pb2) 0.077 0.057 1.370 0.171 0.077 0.099
## pzoop_1 (ps1) -0.418 0.051 -8.229 0.000 -0.418 -0.527
## potam_1 (pt1) -0.070 0.055 -1.290 0.197 -0.070 -0.086
## estfs__1 (pt2) 0.024 0.050 0.486 0.627 0.024 0.030
## flow (pa1) -0.086 0.055 -1.561 0.119 -0.086 -0.106
## temp (pa2) 0.144 0.048 2.995 0.003 0.144 0.186
## turbid (pa3) 0.070 0.054 1.293 0.196 0.070 0.085
## estfish_bsmt_gr ~
## hzoop_1 (fb1) 0.134 0.105 1.274 0.203 0.134 0.082
## pzoop_1 (fb2) -0.120 0.102 -1.184 0.237 -0.120 -0.073
## estfs__1 (fs1) -1.007 0.107 -9.449 0.000 -1.007 -0.606
## flow (fa1) -0.244 0.110 -2.226 0.026 -0.244 -0.144
## temp (fa2) 0.051 0.095 0.536 0.592 0.051 0.032
## turbid (fa3) 0.310 0.105 2.963 0.003 0.310 0.181
## sbss1__1 (ft1) 0.262 0.103 2.536 0.011 0.262 0.156
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .hzoop_gr ~~
## .pzoop_gr 0.076 0.022 3.524 0.000 0.076 0.251
## .estfsh_bsmt_gr -0.118 0.043 -2.766 0.006 -0.118 -0.194
## .pzoop_gr ~~
## .estfsh_bsmt_gr -0.033 0.061 -0.544 0.586 -0.033 -0.038
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .hzoop_gr 0.207 0.020 10.247 0.000 0.207 0.743
## .pzoop_gr 0.444 0.043 10.247 0.000 0.444 0.722
## .estfsh_bsmt_gr 1.777 0.173 10.247 0.000 1.777 0.667
##
## R-Square:
## Estimate
## hzoop_gr 0.257
## pzoop_gr 0.278
## estfsh_bsmt_gr 0.333
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## hb 0.050 0.036 1.393 0.164 0.050 0.088
## hs 0.299 0.039 7.770 0.000 0.299 0.566
## ht 0.123 0.037 3.338 0.001 0.123 0.224
## ha 0.133 0.041 3.264 0.001 0.133 0.241
## pb 0.193 0.048 4.009 0.000 0.193 0.231
## ps 0.418 0.051 8.229 0.000 0.418 0.527
## pt 0.074 0.052 1.424 0.154 0.074 0.091
## pa 0.182 0.055 3.320 0.001 0.182 0.230
## fb 0.180 0.119 1.509 0.131 0.180 0.110
## fs 1.007 0.107 9.449 0.000 1.007 0.606
## ft 0.262 0.103 2.536 0.011 0.262 0.156
## fa 0.398 0.121 3.285 0.001 0.398 0.233
summary(modfitN, standardized=T, rsq=T)
## lavaan 0.6-11 ended normally after 28 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 31
##
## Used Total
## Number of observations 193 312
##
## Model Test User Model:
##
## Test statistic 7.790
## Degrees of freedom 8
## P-value (Chi-square) 0.454
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## hzoop_gr ~
## chla_1 (hb1) 0.037 0.054 0.694 0.488 0.037 0.040
## hzoop_1 (hs1) -0.536 0.053 -10.212 0.000 -0.536 -0.610
## pzoop_1 (ht1) 0.003 0.054 0.052 0.959 0.003 0.003
## corbic_1 (ht2) 0.028 0.050 0.547 0.584 0.028 0.031
## estfs__1 (ht3) -0.058 0.051 -1.137 0.256 -0.058 -0.071
## flow (ha1) 0.135 0.056 2.392 0.017 0.135 0.156
## temp (ha2) 0.035 0.049 0.703 0.482 0.035 0.041
## turbid (ha3) 0.148 0.052 2.852 0.004 0.148 0.167
## pzoop_gr ~
## chla_1 (pb1) 0.385 0.100 3.857 0.000 0.385 0.219
## hzoop_1 (pb2) 0.196 0.097 2.022 0.043 0.196 0.119
## pzoop_1 (ps1) -1.033 0.100 -10.280 0.000 -1.033 -0.631
## corbic_1 (pt1) 0.087 0.094 0.934 0.350 0.087 0.053
## estfs__1 (pt2) -0.092 0.093 -0.984 0.325 -0.092 -0.061
## flow (pa1) -0.543 0.104 -5.229 0.000 -0.543 -0.337
## temp (pa2) 0.061 0.091 0.674 0.500 0.061 0.039
## turbid (pa3) 0.103 0.096 1.073 0.283 0.103 0.062
## estfish_bsmt_gr ~
## hzoop_1 (fb1) 0.324 0.178 1.825 0.068 0.324 0.122
## pzoop_1 (fb2) 0.084 0.179 0.470 0.639 0.084 0.032
## estfs__1 (fs1) -1.431 0.171 -8.371 0.000 -1.431 -0.587
## flow (fa1) -0.646 0.188 -3.444 0.001 -0.646 -0.247
## temp (fa2) 0.047 0.162 0.289 0.772 0.047 0.019
## turbid (fa3) 0.107 0.175 0.613 0.540 0.107 0.040
## sside_1 (ft1) -0.023 0.161 -0.145 0.884 -0.023 -0.009
## cent_1 (ft2) -0.270 0.165 -1.642 0.101 -0.270 -0.106
## sbss1__1 (ft3) 0.193 0.170 1.135 0.257 0.193 0.076
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .hzoop_gr ~~
## .pzoop_gr 0.263 0.062 4.229 0.000 0.263 0.320
## .estfsh_bsmt_gr -0.199 0.107 -1.872 0.061 -0.199 -0.136
## .pzoop_gr ~~
## .estfsh_bsmt_gr 0.076 0.195 0.389 0.697 0.076 0.028
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .hzoop_gr 0.447 0.045 9.823 0.000 0.447 0.610
## .pzoop_gr 1.521 0.155 9.823 0.000 1.521 0.595
## .estfsh_bsmt_gr 4.814 0.490 9.823 0.000 4.814 0.717
##
## R-Square:
## Estimate
## hzoop_gr 0.390
## pzoop_gr 0.405
## estfsh_bsmt_gr 0.283
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## hb 0.037 0.054 0.694 0.488 0.037 0.040
## hs 0.536 0.053 10.212 0.000 0.536 0.610
## ht 0.064 0.053 1.207 0.228 0.064 0.078
## ha 0.203 0.051 4.008 0.000 0.203 0.232
## pb 0.432 0.097 4.469 0.000 0.432 0.250
## ps 1.033 0.100 10.280 0.000 1.033 0.631
## pt 0.127 0.098 1.296 0.195 0.127 0.081
## pa 0.556 0.104 5.345 0.000 0.556 0.344
## fb 0.335 0.166 2.017 0.044 0.335 0.126
## fs 1.431 0.171 8.371 0.000 1.431 0.587
## ft 0.333 0.151 2.201 0.028 0.333 0.130
## fa 0.657 0.189 3.469 0.001 0.657 0.251
summary(modfitS, standardized=T, rsq=T)
## lavaan 0.6-11 ended normally after 32 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 32
##
## Used Total
## Number of observations 199 312
##
## Model Test User Model:
##
## Test statistic 3.561
## Degrees of freedom 7
## P-value (Chi-square) 0.829
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## hzoop_gr ~
## chla_1 (hb1) 0.140 0.046 3.010 0.003 0.140 0.186
## hzoop_1 (hs1) -0.403 0.044 -9.077 0.000 -0.403 -0.553
## pzoop_1 (ht1) -0.028 0.049 -0.570 0.568 -0.028 -0.037
## corbic_1 (ht2) 0.030 0.045 0.678 0.498 0.030 0.040
## estfs__1 (ht3) 0.007 0.044 0.148 0.882 0.007 0.009
## flow (ha1) 0.104 0.046 2.256 0.024 0.104 0.136
## temp (ha2) 0.049 0.043 1.155 0.248 0.049 0.069
## turbid (ha3) -0.043 0.043 -0.986 0.324 -0.043 -0.060
## pzoop_gr ~
## chla_1 (pb1) 0.336 0.077 4.387 0.000 0.336 0.265
## hzoop_1 (pb2) 0.130 0.073 1.766 0.077 0.130 0.105
## pzoop_1 (ps1) -0.772 0.080 -9.614 0.000 -0.772 -0.603
## corbic_1 (pt1) -0.019 0.073 -0.257 0.797 -0.019 -0.015
## estfs__1 (pt2) 0.036 0.073 0.490 0.624 0.036 0.030
## flow (pa1) -0.140 0.076 -1.841 0.066 -0.140 -0.108
## temp (pa2) -0.043 0.070 -0.612 0.540 -0.043 -0.036
## turbid (pa3) 0.107 0.072 1.495 0.135 0.107 0.089
## estfish_bsmt_gr ~
## chla_1 (fb1) 0.226 0.183 1.235 0.217 0.226 0.076
## hzoop_1 (fb2) 0.341 0.178 1.919 0.055 0.341 0.118
## pzoop_1 (fb3) -0.009 0.192 -0.048 0.962 -0.009 -0.003
## estfs__1 (fs1) -1.574 0.178 -8.863 0.000 -1.574 -0.561
## flow (fa1) -0.152 0.184 -0.827 0.409 -0.152 -0.050
## temp (fa2) -0.054 0.168 -0.323 0.746 -0.054 -0.019
## turbid (fa3) 0.468 0.186 2.521 0.012 0.468 0.164
## sside_1 (ft1) -0.026 0.166 -0.159 0.874 -0.026 -0.009
## cent_1 (ft2) -0.237 0.173 -1.372 0.170 -0.237 -0.086
## sbss1__1 (ft3) 0.138 0.176 0.783 0.434 0.138 0.049
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .hzoop_gr ~~
## .pzoop_gr 0.180 0.043 4.240 0.000 0.180 0.315
## .estfsh_bsmt_gr -0.162 0.097 -1.671 0.095 -0.162 -0.119
## .pzoop_gr ~~
## .estfsh_bsmt_gr 0.381 0.161 2.358 0.018 0.381 0.170
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .hzoop_gr 0.346 0.035 9.975 0.000 0.346 0.685
## .pzoop_gr 0.946 0.095 9.975 0.000 0.946 0.656
## .estfsh_bsmt_gr 5.325 0.534 9.975 0.000 5.325 0.671
##
## R-Square:
## Estimate
## hzoop_gr 0.315
## pzoop_gr 0.344
## estfsh_bsmt_gr 0.329
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## hb 0.140 0.046 3.010 0.003 0.140 0.186
## hs 0.403 0.044 9.077 0.000 0.403 0.553
## ht 0.042 0.048 0.856 0.392 0.042 0.055
## ha 0.122 0.047 2.629 0.009 0.122 0.164
## pb 0.360 0.073 4.928 0.000 0.360 0.285
## ps 0.772 0.080 9.614 0.000 0.772 0.603
## pt 0.040 0.072 0.563 0.573 0.040 0.033
## pa 0.181 0.078 2.332 0.020 0.181 0.144
## fb 0.409 0.169 2.421 0.015 0.409 0.141
## fs 1.574 0.178 8.863 0.000 1.574 0.561
## ft 0.276 0.184 1.501 0.133 0.276 0.099
## fa 0.495 0.195 2.533 0.011 0.495 0.173
#modificationindices(modfitW, sort=T, maximum.number=20)
#residuals(modfitS)
labelsfarwest=createLabels(modfitFW, cnameslag)
labelswest=createLabels(modfitW, cnameslag)
labelsnorth=createLabels(modfitN, cnameslag)
labelssouth=createLabels(modfitS, cnameslag)
#FAR WEST
upper_plot_far_west <- createGraph(fit=modfitFW,
reference_df=cnameslag,
model_type="monthly_upper_trophic",
title="Far West",
manual_port_settings=TRUE)
upper_plot_far_west
#WEST
upper_plot_west <- createGraph(fit=modfitW,
reference_df=cnameslag,
model_type="monthly_upper_trophic",
title="West",
manual_port_settings=TRUE)
upper_plot_west
#NORTH
upper_plot_north <- createGraph(fit=modfitN,
reference_df=cnameslag,
model_type="monthly_upper_trophic",
title="North",
manual_port_settings=TRUE)
upper_plot_north
#SOUTH
upper_plot_south <- createGraph(fit=modfitS,
reference_df=cnameslag,
model_type="monthly_upper_trophic",
title="South",
manual_port_settings=TRUE)
upper_plot_south
modFW='din_gr~ns1*din_1+nt1*chla_gr+nn1*hzoop_1+nn2*pzoop_1+nn3*potam_1+na1*flow+na2*temp+na3*turbid
chla_gr~cb1*din_1+cs1*chla_1+ct1*hzoop_1+ct2*potam_1+ca1*flow+ca2*temp+ca3*turbid
potam~lb1*chla_1+lb2*hzoop_1+lb3*pzoop_1+ls1*potam_1+la1*flow+la2*temp+la3*turbid
ns:=sqrt(ns1^2)
nt:=sqrt(nt1^2)
nn:=sqrt(nn1^2+nn2^2+nn3^2)
na:=sqrt(na1^2+na2^2+na3^2)
cb:=sqrt(cb1^2)
cs:=sqrt(cs1^2)
ct:=sqrt(ct1^2+ct2^2)
ca:=sqrt(ca1^2+ca2^2+ca3^2)
lb:=sqrt(lb1^2+lb2^2+lb3^2)
ls:=sqrt(ls1^2)
la:=sqrt(la1^2+la2^2+la3^2)
'
modW='din_gr~ns1*din_1+nt1*chla_gr+nn1*hzoop_1+nn2*pzoop_1+nn3*potam_1+na1*flow+na2*temp+na3*turbid
chla_gr~cb1*din_1+cs1*chla_1+ct1*hzoop_1+ct2*potam_1+ca1*flow+ca2*temp+ca3*turbid
potam~lb1*din_1+lb2*chla_1+lb3*hzoop_1+lb4*pzoop_1+ls1*potam_1+la1*flow+la2*temp+la3*turbid
ns:=sqrt(ns1^2)
nt:=sqrt(nt1^2)
nn:=sqrt(nn1^2+nn2^2+nn3^2)
na:=sqrt(na1^2+na2^2+na3^2)
cb:=sqrt(cb1^2)
cs:=sqrt(cs1^2)
ct:=sqrt(ct1^2+ct2^2)
ca:=sqrt(ca1^2+ca2^2+ca3^2)
lb:=sqrt(lb1^2+lb2^2+lb3^2+lb4^2)
ls:=sqrt(ls1^2)
la:=sqrt(la1^2+la2^2+la3^2)
'
modN='din_gr~ns1*din_1+nt1*chla_gr+nn1*hzoop_1+nn2*pzoop_1+nn3*corbic_1+na1*flow+na2*temp+na3*turbid
chla_gr~cb1*din_1+cs1*chla_1+ct1*hzoop_1+ct2*corbic_1+ct3*pzoop_1+ca1*flow+ca2*temp+ca3*turbid
corbic~lb1*chla_1+lb2*hzoop_1+lb3*pzoop_1+ls1*corbic_1+la1*flow+la2*temp+la3*turbid
ns:=sqrt(ns1^2)
nt:=sqrt(nt1^2)
nn:=sqrt(nn1^2+nn2^2+nn3^2)
na:=sqrt(na1^2+na2^2+na3^2)
cb:=sqrt(cb1^2)
cs:=sqrt(cs1^2)
ct:=sqrt(ct1^2+ct2^2+ct3^2)
ca:=sqrt(ca1^2+ca2^2+ca3^2)
lb:=sqrt(lb1^2+lb2^2+lb3^2)
ls:=sqrt(ls1^2)
la:=sqrt(la1^2+la2^2+la3^2)
'
modS='din_gr~ns1*din_1+nt1*chla_gr+nn1*hzoop_1+nn2*pzoop_1+nn3*corbic_1+na1*flow+na2*temp+na3*turbid
chla_gr~cb1*din_1+cs1*chla_1+ct1*hzoop_1+ct2*corbic_1+ca1*flow+ca2*temp+ca3*turbid
corbic~lb1*chla_1+lb2*hzoop_1+lb3*pzoop_1+ls1*corbic_1+la1*flow+la2*temp+la3*turbid
ns:=sqrt(ns1^2)
nt:=sqrt(nt1^2)
nn:=sqrt(nn1^2+nn2^2+nn3^2)
na:=sqrt(na1^2+na2^2+na3^2)
cb:=sqrt(cb1^2)
cs:=sqrt(cs1^2)
ct:=sqrt(ct1^2+ct2^2)
ca:=sqrt(ca1^2+ca2^2+ca3^2)
lb:=sqrt(lb1^2+lb2^2+lb3^2)
ls:=sqrt(ls1^2)
la:=sqrt(la1^2+la2^2+la3^2)
'
modfitFW=sem(modFW, data=filter(fdr_ds,region=="Far West"))
modfitW=sem(modW, data=filter(fdr_ds,region=="West"))
modfitN=sem(modN, data=filter(fdr_ds,region=="North"))
modfitS=sem(modS, data=filter(fdr_ds,region=="South"))
summary(modfitFW, standardized=T, rsq=T)
## lavaan 0.6-11 ended normally after 20 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 26
##
## Used Total
## Number of observations 234 312
##
## Model Test User Model:
##
## Test statistic 5.222
## Degrees of freedom 4
## P-value (Chi-square) 0.265
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## din_gr ~
## din_1 (ns1) -0.218 0.025 -8.695 0.000 -0.218 -0.487
## chla_gr (nt1) -0.160 0.051 -3.135 0.002 -0.160 -0.175
## hzoop_1 (nn1) -0.001 0.026 -0.033 0.974 -0.001 -0.002
## pzoop_1 (nn2) -0.010 0.025 -0.400 0.689 -0.010 -0.023
## potam_1 (nn3) -0.002 0.025 -0.068 0.946 -0.002 -0.004
## flow (na1) 0.003 0.029 0.113 0.910 0.003 0.007
## temp (na2) -0.046 0.028 -1.641 0.101 -0.046 -0.098
## turbid (na3) -0.054 0.029 -1.839 0.066 -0.054 -0.113
## chla_gr ~
## din_1 (cb1) 0.000 0.027 0.004 0.997 0.000 0.000
## chla_1 (cs1) -0.323 0.034 -9.629 0.000 -0.323 -0.538
## hzoop_1 (ct1) -0.002 0.028 -0.084 0.933 -0.002 -0.005
## potam_1 (ct2) -0.015 0.027 -0.548 0.584 -0.015 -0.031
## flow (ca1) 0.014 0.031 0.463 0.644 0.014 0.028
## temp (ca2) 0.044 0.030 1.470 0.141 0.044 0.086
## turbid (ca3) -0.025 0.032 -0.788 0.431 -0.025 -0.048
## potam ~
## chla_1 (lb1) 0.056 0.060 0.939 0.348 0.056 0.045
## hzoop_1 (lb2) -0.074 0.051 -1.437 0.151 -0.074 -0.071
## pzoop_1 (lb3) -0.163 0.050 -3.266 0.001 -0.163 -0.161
## potam_1 (ls1) 0.630 0.048 13.022 0.000 0.630 0.630
## flow (la1) 0.113 0.057 1.981 0.048 0.113 0.103
## temp (la2) -0.043 0.054 -0.799 0.425 -0.043 -0.040
## turbid (la3) 0.036 0.058 0.624 0.533 0.036 0.033
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .din_gr ~~
## .potam -0.017 0.019 -0.916 0.360 -0.017 -0.060
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .din_gr 0.147 0.014 10.817 0.000 0.147 0.708
## .chla_gr 0.172 0.016 10.817 0.000 0.172 0.694
## .potam 0.568 0.053 10.817 0.000 0.568 0.518
##
## R-Square:
## Estimate
## din_gr 0.292
## chla_gr 0.306
## potam 0.482
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## ns 0.218 0.025 8.695 0.000 0.218 0.487
## nt 0.160 0.051 3.135 0.002 0.160 0.175
## nn 0.010 0.025 0.407 0.684 0.010 0.023
## na 0.071 0.032 2.207 0.027 0.071 0.150
## cb 0.000 0.027 0.004 0.997 0.000 0.000
## cs 0.323 0.034 9.629 0.000 0.323 0.538
## ct 0.015 0.028 0.536 0.592 0.015 0.031
## ca 0.053 0.029 1.791 0.073 0.053 0.103
## lb 0.188 0.049 3.824 0.000 0.188 0.182
## ls 0.630 0.048 13.022 0.000 0.630 0.630
## la 0.127 0.049 2.578 0.010 0.127 0.116
summary(modfitW, standardized=T, rsq=T)
## lavaan 0.6-11 ended normally after 25 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 27
##
## Used Total
## Number of observations 257 312
##
## Model Test User Model:
##
## Test statistic 17.150
## Degrees of freedom 3
## P-value (Chi-square) 0.001
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## din_gr ~
## din_1 (ns1) -0.196 0.020 -9.655 0.000 -0.196 -0.567
## chla_gr (nt1) -0.122 0.033 -3.700 0.000 -0.122 -0.191
## hzoop_1 (nn1) -0.013 0.020 -0.647 0.518 -0.013 -0.039
## pzoop_1 (nn2) 0.010 0.019 0.504 0.614 0.010 0.028
## potam_1 (nn3) 0.020 0.021 0.969 0.333 0.020 0.059
## flow (na1) -0.121 0.021 -5.654 0.000 -0.121 -0.341
## temp (na2) 0.020 0.018 1.072 0.284 0.020 0.057
## turbid (na3) 0.039 0.020 1.979 0.048 0.039 0.113
## chla_gr ~
## din_1 (cb1) -0.063 0.032 -1.958 0.050 -0.063 -0.117
## chla_1 (cs1) -0.370 0.034 -11.003 0.000 -0.370 -0.618
## hzoop_1 (ct1) 0.048 0.031 1.556 0.120 0.048 0.091
## potam_1 (ct2) 0.014 0.033 0.425 0.671 0.014 0.026
## flow (ca1) 0.001 0.033 0.026 0.980 0.001 0.002
## temp (ca2) -0.042 0.028 -1.487 0.137 -0.042 -0.079
## turbid (ca3) -0.012 0.031 -0.398 0.691 -0.012 -0.023
## potam ~
## din_1 (lb1) 0.076 0.044 1.731 0.083 0.076 0.075
## chla_1 (lb2) -0.006 0.046 -0.124 0.901 -0.006 -0.005
## hzoop_1 (lb3) -0.008 0.044 -0.172 0.864 -0.008 -0.008
## pzoop_1 (lb4) 0.070 0.041 1.738 0.082 0.070 0.070
## potam_1 (ls1) 0.707 0.044 15.987 0.000 0.707 0.701
## flow (la1) -0.112 0.045 -2.496 0.013 -0.112 -0.108
## temp (la2) -0.008 0.039 -0.201 0.841 -0.008 -0.008
## turbid (la3) -0.079 0.042 -1.884 0.060 -0.079 -0.078
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .din_gr ~~
## .potam 0.013 0.011 1.209 0.227 0.013 0.076
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .din_gr 0.081 0.007 11.336 0.000 0.081 0.680
## .chla_gr 0.195 0.017 11.336 0.000 0.195 0.674
## .potam 0.359 0.032 11.336 0.000 0.359 0.351
##
## R-Square:
## Estimate
## din_gr 0.320
## chla_gr 0.326
## potam 0.649
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## ns 0.196 0.020 9.655 0.000 0.196 0.567
## nt 0.122 0.033 3.700 0.000 0.122 0.191
## nn 0.026 0.021 1.265 0.206 0.026 0.076
## na 0.128 0.022 5.778 0.000 0.128 0.364
## cb 0.063 0.032 1.958 0.050 0.063 0.117
## cs 0.370 0.034 11.003 0.000 0.370 0.618
## ct 0.050 0.033 1.512 0.131 0.050 0.094
## ca 0.044 0.030 1.464 0.143 0.044 0.082
## lb 0.104 0.042 2.490 0.013 0.104 0.103
## ls 0.707 0.044 15.987 0.000 0.707 0.701
## la 0.137 0.040 3.416 0.001 0.137 0.133
summary(modfitN, standardized=T, rsq=T)
## lavaan 0.6-11 ended normally after 20 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 27
##
## Used Total
## Number of observations 255 312
##
## Model Test User Model:
##
## Test statistic 23.323
## Degrees of freedom 3
## P-value (Chi-square) 0.000
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## din_gr ~
## din_1 (ns1) -0.336 0.026 -13.181 0.000 -0.336 -0.679
## chla_gr (nt1) -0.108 0.033 -3.258 0.001 -0.108 -0.155
## hzoop_1 (nn1) 0.011 0.025 0.461 0.645 0.011 0.023
## pzoop_1 (nn2) 0.057 0.026 2.209 0.027 0.057 0.113
## corbic_1 (nn3) -0.010 0.024 -0.408 0.684 -0.010 -0.019
## flow (na1) -0.175 0.027 -6.459 0.000 -0.175 -0.344
## temp (na2) 0.020 0.024 0.839 0.402 0.020 0.041
## turbid (na3) 0.016 0.023 0.697 0.486 0.016 0.033
## chla_gr ~
## din_1 (cb1) 0.012 0.040 0.309 0.758 0.012 0.017
## chla_1 (cs1) -0.398 0.037 -10.807 0.000 -0.398 -0.561
## hzoop_1 (ct1) -0.015 0.038 -0.393 0.695 -0.015 -0.021
## corbic_1 (ct2) 0.013 0.038 0.350 0.726 0.013 0.018
## pzoop_1 (ct3) -0.087 0.040 -2.155 0.031 -0.087 -0.119
## flow (ca1) -0.048 0.042 -1.138 0.255 -0.048 -0.066
## temp (ca2) 0.058 0.038 1.557 0.119 0.058 0.082
## turbid (ca3) 0.046 0.036 1.268 0.205 0.046 0.065
## corbic ~
## chla_1 (lb1) -0.001 0.053 -0.021 0.983 -0.001 -0.001
## hzoop_1 (lb2) 0.011 0.056 0.194 0.847 0.011 0.011
## pzoop_1 (lb3) -0.010 0.058 -0.177 0.859 -0.010 -0.010
## corbic_1 (ls1) 0.462 0.056 8.308 0.000 0.462 0.460
## flow (la1) 0.093 0.060 1.553 0.120 0.093 0.092
## temp (la2) -0.034 0.055 -0.616 0.538 -0.034 -0.035
## turbid (la3) -0.117 0.053 -2.207 0.027 -0.117 -0.121
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .din_gr ~~
## .corbic -0.010 0.019 -0.504 0.614 -0.010 -0.032
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .din_gr 0.135 0.012 11.292 0.000 0.135 0.547
## .chla_gr 0.331 0.029 11.292 0.000 0.331 0.647
## .corbic 0.715 0.063 11.292 0.000 0.715 0.740
##
## R-Square:
## Estimate
## din_gr 0.453
## chla_gr 0.353
## corbic 0.260
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## ns 0.336 0.026 13.181 0.000 0.336 0.679
## nt 0.108 0.033 3.258 0.001 0.108 0.155
## nn 0.059 0.025 2.413 0.016 0.059 0.117
## na 0.177 0.027 6.577 0.000 0.177 0.348
## cb 0.012 0.040 0.309 0.758 0.012 0.017
## cs 0.398 0.037 10.807 0.000 0.398 0.561
## ct 0.089 0.038 2.326 0.020 0.089 0.122
## ca 0.089 0.038 2.325 0.020 0.089 0.124
## lb 0.015 0.063 0.241 0.810 0.015 0.015
## ls 0.462 0.056 8.308 0.000 0.462 0.460
## la 0.153 0.057 2.686 0.007 0.153 0.156
summary(modfitS, standardized=T, rsq=T)
## lavaan 0.6-11 ended normally after 19 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 26
##
## Used Total
## Number of observations 256 312
##
## Model Test User Model:
##
## Test statistic 2.541
## Degrees of freedom 4
## P-value (Chi-square) 0.637
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## din_gr ~
## din_1 (ns1) -0.297 0.028 -10.569 0.000 -0.297 -0.576
## chla_gr (nt1) -0.100 0.035 -2.895 0.004 -0.100 -0.149
## hzoop_1 (nn1) -0.015 0.029 -0.510 0.610 -0.015 -0.027
## pzoop_1 (nn2) -0.010 0.030 -0.341 0.733 -0.010 -0.018
## corbic_1 (nn3) 0.038 0.027 1.379 0.168 0.038 0.073
## flow (na1) -0.007 0.028 -0.262 0.794 -0.007 -0.014
## temp (na2) 0.045 0.027 1.660 0.097 0.045 0.086
## turbid (na3) 0.091 0.029 3.169 0.002 0.091 0.175
## chla_gr ~
## din_1 (cb1) -0.017 0.042 -0.400 0.689 -0.017 -0.022
## chla_1 (cs1) -0.441 0.042 -10.576 0.000 -0.441 -0.567
## hzoop_1 (ct1) 0.060 0.044 1.359 0.174 0.060 0.075
## corbic_1 (ct2) 0.048 0.041 1.170 0.242 0.048 0.063
## flow (ca1) -0.076 0.042 -1.822 0.068 -0.076 -0.097
## temp (ca2) 0.008 0.041 0.186 0.853 0.008 0.010
## turbid (ca3) 0.015 0.044 0.336 0.737 0.015 0.019
## corbic ~
## chla_1 (lb1) 0.046 0.059 0.775 0.438 0.046 0.046
## hzoop_1 (lb2) -0.023 0.062 -0.370 0.712 -0.023 -0.022
## pzoop_1 (lb3) -0.040 0.063 -0.637 0.524 -0.040 -0.038
## corbic_1 (ls1) 0.315 0.058 5.474 0.000 0.315 0.318
## flow (la1) 0.081 0.059 1.384 0.166 0.081 0.080
## temp (la2) -0.078 0.058 -1.349 0.177 -0.078 -0.077
## turbid (la3) 0.185 0.058 3.205 0.001 0.185 0.186
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .din_gr ~~
## .corbic -0.024 0.024 -0.980 0.327 -0.024 -0.061
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .din_gr 0.182 0.016 11.314 0.000 0.182 0.662
## .chla_gr 0.415 0.037 11.314 0.000 0.415 0.688
## .corbic 0.812 0.072 11.314 0.000 0.812 0.809
##
## R-Square:
## Estimate
## din_gr 0.338
## chla_gr 0.312
## corbic 0.191
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## ns 0.297 0.028 10.569 0.000 0.297 0.576
## nt 0.100 0.035 2.895 0.004 0.100 0.149
## nn 0.042 0.028 1.490 0.136 0.042 0.080
## na 0.102 0.029 3.487 0.000 0.102 0.196
## cb 0.017 0.042 0.400 0.689 0.017 0.022
## cs 0.441 0.042 10.576 0.000 0.441 0.567
## ct 0.077 0.041 1.872 0.061 0.077 0.098
## ca 0.078 0.043 1.831 0.067 0.078 0.099
## lb 0.065 0.066 0.987 0.324 0.065 0.063
## ls 0.315 0.058 5.474 0.000 0.315 0.318
## la 0.217 0.055 3.918 0.000 0.217 0.217
#modificationindices(modfitW, sort=T, maximum.number=20)
#residuals(modfitW)
labelsfarwest=createLabels(modfitFW, cnameslag)
labelswest=createLabels(modfitW, cnameslag)
labelsnorth=createLabels(modfitN, cnameslag)
labelssouth=createLabels(modfitS, cnameslag)
#FAR WEST
lower_plot_far_west <- createGraph(fit=modfitFW,
reference_df=cnameslag,
model_type="monthly_lower_trophic",
title="Far West",
manual_port_settings=TRUE)
lower_plot_far_west
#WEST
lower_plot_west <- createGraph(fit=modfitW,
reference_df=cnameslag,
model_type="monthly_lower_trophic",
title="West",
manual_port_settings=TRUE)
lower_plot_west
#NORTH
lower_plot_north <- createGraph(fit=modfitN,
reference_df=cnameslag,
model_type="monthly_lower_trophic",
title="North",
manual_port_settings=TRUE)
lower_plot_north
#SOUTH
lower_plot_south <- createGraph(fit=modfitS,
reference_df=cnameslag,
model_type="monthly_lower_trophic",
title="South",
manual_port_settings=TRUE)
lower_plot_south
modFW='chla_gr~chla_1+hcope_1+amphi_m_1+rotif_m_1+potam_1+flow+turbid+temp
hcope_gr~chla_1+hcope_1+pcope_1+potam_1+flow+turbid+temp+estfish_bsmt_1
amphi_m_gr~chla_1+amphi_m_1+flow+turbid+temp+estfish_bsmt_1
rotif_m_gr~chla_1+rotif_m_1+flow+turbid+temp+estfish_bsmt_1
pcope_gr~hcope_1+pcope_1+potam_1+flow+turbid+temp+estfish_bsmt_1
estfish_bsmt_gr~estfish_bsmt_1+hcope_1+pcope_1+amphi_m_1+rotif_m_1+flow+turbid+temp
'
modW='chla_gr~chla_1+hcope_1+amphi_m_1+rotif_m_1+potam_1+flow+turbid+temp+mysid_1
hcope_gr~chla_1+hcope_1+pcope_1+mysid_1+potam_1+flow+turbid+temp+estfish_bsmt_1+rotif_m_1
amphi_m_gr~chla_1+amphi_m_1+mysid_1+flow+turbid+temp+estfish_bsmt_1
rotif_m_gr~chla_1+rotif_m_1+flow+turbid+temp+estfish_bsmt_1
pcope_gr~hcope_1+pcope_1+mysid_1+potam_1+flow+turbid+temp+estfish_bsmt_1+rotif_m_1
mysid_gr~chla_1+hcope_1+pcope_1+amphi_m_1+mysid_1+flow+turbid+temp+estfish_bsmt_1
estfish_bsmt_gr~estfish_bsmt_1+hcope_1+pcope_1+amphi_m_1+rotif_m_1+mysid_1+flow+turbid+temp
'
modN='chla_gr~chla_1+hcope_1+amphi_m_1+rotif_m_1+corbic_1+flow+turbid+temp
hcope_gr~chla_1+hcope_1+pcope_1+mysid_1+corbic_1+flow+turbid+temp+estfish_bsmt_1
amphi_m_gr~chla_1+amphi_m_1+flow+turbid+temp+estfish_bsmt_1
rotif_m_gr~chla_1+rotif_m_1+flow+turbid+temp+estfish_bsmt_1
pcope_gr~hcope_1+pcope_1+mysid_1+corbic_1+flow+turbid+temp+estfish_bsmt_1+chla_1
mysid_gr~hcope_1+pcope_1+mysid_1+amphi_m_1+flow+turbid+temp+estfish_bsmt_1
estfish_bsmt_gr~estfish_bsmt_1+hcope_1+pcope_1+amphi_m_1+rotif_m_1+mysid_1+flow+turbid+temp
'
modS='chla_gr~chla_1+hcope_1+clad_1+rotif_m_1+corbic_1+flow+turbid+temp
hcope_gr~chla_1+hcope_1+pcope_1+corbic_1+flow+turbid+temp+estfish_bsmt_1
clad_gr~chla_1+clad_1+pcope_1+flow+turbid+temp+estfish_bsmt_1
amphi_m_gr~chla_1+amphi_m_1+flow+turbid+temp+estfish_bsmt_1
rotif_m_gr~chla_1+rotif_m_1+flow+turbid+temp+estfish_bsmt_1
pcope_gr~chla_1+hcope_1+clad_1+pcope_1+corbic_1+flow+turbid+temp+estfish_bsmt_1
estfish_bsmt_gr~estfish_bsmt_1+hcope_1+pcope_1+amphi_m_1+rotif_m_1+clad_1+flow+turbid+temp
'
modfitFW=sem(modFW, data=filter(fdr_ds,region=="Far West"))
modfitW=sem(modW, data=filter(fdr_ds,region=="West"))
modfitN=sem(modN, data=filter(fdr_ds,region=="North"))
modfitS=sem(modS, data=filter(fdr_ds,region=="South"))
summary(modfitFW, standardized=T, rsq=T)
## lavaan 0.6-11 ended normally after 46 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 64
##
## Used Total
## Number of observations 183 312
##
## Model Test User Model:
##
## Test statistic 22.686
## Degrees of freedom 17
## P-value (Chi-square) 0.160
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## chla_gr ~
## chla_1 -0.339 0.037 -9.191 0.000 -0.339 -0.565
## hcope_1 0.046 0.030 1.539 0.124 0.046 0.095
## amphi_m_1 0.012 0.036 0.317 0.751 0.012 0.024
## rotif_m_1 -0.029 0.035 -0.842 0.400 -0.029 -0.055
## potam_1 -0.006 0.027 -0.209 0.834 -0.006 -0.013
## flow 0.032 0.040 0.807 0.420 0.032 0.062
## turbid -0.037 0.039 -0.944 0.345 -0.037 -0.066
## temp 0.028 0.034 0.817 0.414 0.028 0.053
## hcope_gr ~
## chla_1 0.147 0.080 1.843 0.065 0.147 0.104
## hcope_1 -0.720 0.070 -10.354 0.000 -0.720 -0.627
## pcope_1 0.068 0.072 0.943 0.346 0.068 0.056
## potam_1 -0.112 0.061 -1.815 0.069 -0.112 -0.107
## flow -0.075 0.081 -0.920 0.357 -0.075 -0.061
## turbid -0.048 0.085 -0.559 0.576 -0.048 -0.036
## temp -0.047 0.077 -0.617 0.537 -0.047 -0.038
## estfish_bsmt_1 -0.137 0.077 -1.780 0.075 -0.137 -0.114
## amphi_m_gr ~
## chla_1 0.071 0.083 0.857 0.391 0.071 0.056
## amphi_m_1 -0.533 0.080 -6.701 0.000 -0.533 -0.521
## flow -0.510 0.089 -5.747 0.000 -0.510 -0.467
## turbid 0.003 0.086 0.040 0.968 0.003 0.003
## temp 0.063 0.077 0.821 0.412 0.063 0.056
## estfish_bsmt_1 0.096 0.074 1.292 0.196 0.096 0.090
## rotif_m_gr ~
## chla_1 -0.394 0.163 -2.419 0.016 -0.394 -0.148
## rotif_m_1 -1.313 0.147 -8.954 0.000 -1.313 -0.549
## flow 0.148 0.161 0.919 0.358 0.148 0.065
## turbid 0.083 0.170 0.486 0.627 0.083 0.034
## temp 0.071 0.152 0.465 0.642 0.071 0.030
## estfish_bsmt_1 -0.007 0.143 -0.052 0.958 -0.007 -0.003
## pcope_gr ~
## hcope_1 0.132 0.134 0.985 0.325 0.132 0.062
## pcope_1 -1.295 0.138 -9.365 0.000 -1.295 -0.582
## potam_1 -0.197 0.117 -1.682 0.092 -0.197 -0.102
## flow 0.358 0.156 2.304 0.021 0.358 0.157
## turbid 0.206 0.164 1.256 0.209 0.206 0.084
## temp 0.241 0.148 1.623 0.104 0.241 0.103
## estfish_bsmt_1 -0.030 0.147 -0.205 0.838 -0.030 -0.014
## estfish_bsmt_gr ~
## estfish_bsmt_1 -1.318 0.150 -8.780 0.000 -1.318 -0.587
## hcope_1 -0.234 0.136 -1.725 0.084 -0.234 -0.109
## pcope_1 0.314 0.141 2.224 0.026 0.314 0.140
## amphi_m_1 -0.138 0.160 -0.862 0.389 -0.138 -0.064
## rotif_m_1 -0.321 0.150 -2.139 0.032 -0.321 -0.134
## flow 0.155 0.172 0.898 0.369 0.155 0.067
## turbid 0.448 0.169 2.653 0.008 0.448 0.182
## temp -0.078 0.151 -0.515 0.607 -0.078 -0.033
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla_gr ~~
## .hcope_gr 0.020 0.029 0.706 0.480 0.020 0.052
## .amphi_m_gr -0.001 0.029 -0.038 0.970 -0.001 -0.003
## .rotif_m_gr 0.143 0.059 2.437 0.015 0.143 0.183
## .pcope_gr 0.045 0.056 0.801 0.423 0.045 0.059
## .estfsh_bsmt_gr -0.055 0.057 -0.966 0.334 -0.055 -0.072
## .hcope_gr ~~
## .amphi_m_gr -0.033 0.065 -0.506 0.613 -0.033 -0.037
## .rotif_m_gr 0.149 0.129 1.159 0.246 0.149 0.086
## .pcope_gr -0.371 0.127 -2.913 0.004 -0.371 -0.220
## .estfsh_bsmt_gr -0.108 0.126 -0.856 0.392 -0.108 -0.063
## .amphi_m_gr ~~
## .rotif_m_gr -0.234 0.130 -1.801 0.072 -0.234 -0.134
## .pcope_gr 0.018 0.125 0.144 0.886 0.018 0.011
## .estfsh_bsmt_gr 0.005 0.126 0.038 0.970 0.005 0.003
## .rotif_m_gr ~~
## .pcope_gr -0.196 0.248 -0.791 0.429 -0.196 -0.059
## .estfsh_bsmt_gr -0.116 0.250 -0.466 0.641 -0.116 -0.034
## .pcope_gr ~~
## .estfsh_bsmt_gr -0.513 0.245 -2.092 0.036 -0.513 -0.157
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla_gr 0.176 0.018 9.566 0.000 0.176 0.677
## .hcope_gr 0.873 0.091 9.566 0.000 0.873 0.596
## .amphi_m_gr 0.875 0.092 9.566 0.000 0.875 0.754
## .rotif_m_gr 3.452 0.361 9.566 0.000 3.452 0.677
## .pcope_gr 3.242 0.339 9.566 0.000 3.242 0.643
## .estfsh_bsmt_gr 3.312 0.346 9.566 0.000 3.312 0.644
##
## R-Square:
## Estimate
## chla_gr 0.323
## hcope_gr 0.404
## amphi_m_gr 0.246
## rotif_m_gr 0.323
## pcope_gr 0.357
## estfsh_bsmt_gr 0.356
summary(modfitW, standardized=T, rsq=T)
## lavaan 0.6-11 ended normally after 44 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 87
##
## Used Total
## Number of observations 202 312
##
## Model Test User Model:
##
## Test statistic 24.900
## Degrees of freedom 18
## P-value (Chi-square) 0.128
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## chla_gr ~
## chla_1 -0.352 0.037 -9.401 0.000 -0.352 -0.601
## hcope_1 0.060 0.036 1.652 0.099 0.060 0.105
## amphi_m_1 0.050 0.033 1.486 0.137 0.050 0.093
## rotif_m_1 0.063 0.032 1.956 0.050 0.063 0.123
## potam_1 -0.012 0.036 -0.328 0.743 -0.012 -0.021
## flow -0.009 0.037 -0.241 0.810 -0.009 -0.016
## turbid 0.019 0.038 0.499 0.617 0.019 0.034
## temp -0.062 0.033 -1.910 0.056 -0.062 -0.117
## mysid_1 -0.052 0.036 -1.449 0.147 -0.052 -0.093
## hcope_gr ~
## chla_1 0.043 0.040 1.100 0.272 0.043 0.067
## hcope_1 -0.353 0.040 -8.853 0.000 -0.353 -0.561
## pcope_1 -0.051 0.035 -1.455 0.146 -0.051 -0.087
## mysid_1 0.034 0.041 0.841 0.400 0.034 0.055
## potam_1 -0.088 0.037 -2.378 0.017 -0.088 -0.143
## flow -0.086 0.041 -2.110 0.035 -0.086 -0.139
## turbid -0.044 0.041 -1.064 0.287 -0.044 -0.071
## temp 0.035 0.036 0.987 0.324 0.035 0.060
## estfish_bsmt_1 0.016 0.036 0.461 0.645 0.016 0.027
## rotif_m_1 0.101 0.034 2.995 0.003 0.101 0.179
## amphi_m_gr ~
## chla_1 -0.082 0.064 -1.282 0.200 -0.082 -0.086
## amphi_m_1 -0.303 0.061 -4.933 0.000 -0.303 -0.346
## mysid_1 0.154 0.062 2.486 0.013 0.154 0.168
## flow 0.004 0.063 0.062 0.951 0.004 0.004
## turbid -0.210 0.066 -3.181 0.001 -0.210 -0.228
## temp -0.163 0.058 -2.819 0.005 -0.163 -0.187
## estfish_bsmt_1 -0.251 0.061 -4.084 0.000 -0.251 -0.281
## rotif_m_gr ~
## chla_1 0.021 0.109 0.196 0.844 0.021 0.012
## rotif_m_1 -0.886 0.096 -9.190 0.000 -0.886 -0.574
## flow 0.307 0.110 2.792 0.005 0.307 0.182
## turbid -0.245 0.109 -2.249 0.025 -0.245 -0.144
## temp -0.003 0.098 -0.032 0.974 -0.003 -0.002
## estfish_bsmt_1 -0.214 0.097 -2.202 0.028 -0.214 -0.130
## pcope_gr ~
## hcope_1 -0.136 0.061 -2.224 0.026 -0.136 -0.142
## pcope_1 -0.495 0.057 -8.658 0.000 -0.495 -0.554
## mysid_1 0.123 0.064 1.935 0.053 0.123 0.131
## potam_1 0.032 0.063 0.509 0.611 0.032 0.034
## flow 0.116 0.063 1.844 0.065 0.116 0.124
## turbid -0.073 0.065 -1.131 0.258 -0.073 -0.077
## temp 0.184 0.055 3.360 0.001 0.184 0.206
## estfish_bsmt_1 0.001 0.057 0.011 0.991 0.001 0.001
## rotif_m_1 0.141 0.055 2.561 0.010 0.141 0.164
## mysid_gr ~
## chla_1 0.272 0.084 3.243 0.001 0.272 0.208
## hcope_1 0.078 0.082 0.943 0.346 0.078 0.061
## pcope_1 0.132 0.073 1.803 0.071 0.132 0.111
## amphi_m_1 -0.120 0.076 -1.583 0.113 -0.120 -0.100
## mysid_1 -0.699 0.086 -8.152 0.000 -0.699 -0.558
## flow -0.209 0.081 -2.577 0.010 -0.209 -0.167
## turbid 0.329 0.087 3.776 0.000 0.329 0.261
## temp 0.118 0.075 1.567 0.117 0.118 0.099
## estfish_bsmt_1 0.012 0.078 0.153 0.878 0.012 0.010
## estfish_bsmt_gr ~
## estfish_bsmt_1 -0.970 0.104 -9.366 0.000 -0.970 -0.585
## hcope_1 0.104 0.106 0.980 0.327 0.104 0.060
## pcope_1 -0.028 0.101 -0.272 0.786 -0.028 -0.017
## amphi_m_1 -0.270 0.104 -2.609 0.009 -0.270 -0.166
## rotif_m_1 0.011 0.098 0.115 0.908 0.011 0.007
## mysid_1 -0.163 0.112 -1.452 0.147 -0.163 -0.096
## flow -0.225 0.108 -2.080 0.038 -0.225 -0.133
## turbid 0.259 0.114 2.266 0.023 0.259 0.152
## temp 0.072 0.097 0.748 0.455 0.072 0.045
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla_gr ~~
## .hcope_gr 0.058 0.016 3.617 0.000 0.058 0.263
## .amphi_m_gr 0.006 0.025 0.243 0.808 0.006 0.017
## .rotif_m_gr 0.126 0.044 2.858 0.004 0.126 0.205
## .pcope_gr -0.012 0.024 -0.493 0.622 -0.012 -0.035
## .mysid_gr 0.080 0.033 2.438 0.015 0.080 0.174
## .estfsh_bsmt_gr -0.029 0.043 -0.675 0.499 -0.029 -0.048
## .hcope_gr ~~
## .amphi_m_gr -0.046 0.028 -1.664 0.096 -0.046 -0.118
## .rotif_m_gr -0.027 0.047 -0.566 0.572 -0.027 -0.040
## .pcope_gr 0.027 0.026 1.025 0.306 0.027 0.072
## .mysid_gr 0.183 0.038 4.865 0.000 0.183 0.364
## .estfsh_bsmt_gr -0.121 0.047 -2.570 0.010 -0.121 -0.184
## .amphi_m_gr ~~
## .rotif_m_gr 0.127 0.077 1.656 0.098 0.127 0.117
## .pcope_gr 0.010 0.043 0.245 0.806 0.010 0.017
## .mysid_gr -0.111 0.058 -1.908 0.056 -0.111 -0.135
## .estfsh_bsmt_gr 0.044 0.075 0.585 0.558 0.044 0.041
## .rotif_m_gr ~~
## .pcope_gr 0.077 0.073 1.052 0.293 0.077 0.074
## .mysid_gr -0.102 0.099 -1.032 0.302 -0.102 -0.073
## .estfsh_bsmt_gr 0.173 0.130 1.339 0.180 0.173 0.095
## .pcope_gr ~~
## .mysid_gr -0.035 0.055 -0.634 0.526 -0.035 -0.045
## .estfsh_bsmt_gr -0.016 0.072 -0.217 0.828 -0.016 -0.015
## .mysid_gr ~~
## .estfsh_bsmt_gr -0.069 0.097 -0.714 0.475 -0.069 -0.050
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla_gr 0.202 0.020 10.050 0.000 0.202 0.683
## .hcope_gr 0.239 0.024 10.050 0.000 0.239 0.660
## .amphi_m_gr 0.633 0.063 10.050 0.000 0.633 0.802
## .rotif_m_gr 1.861 0.185 10.050 0.000 1.861 0.689
## .pcope_gr 0.577 0.057 10.050 0.000 0.577 0.693
## .mysid_gr 1.057 0.105 10.050 0.000 1.057 0.713
## .estfsh_bsmt_gr 1.804 0.180 10.050 0.000 1.804 0.663
##
## R-Square:
## Estimate
## chla_gr 0.317
## hcope_gr 0.340
## amphi_m_gr 0.198
## rotif_m_gr 0.311
## pcope_gr 0.307
## mysid_gr 0.287
## estfsh_bsmt_gr 0.337
summary(modfitN, standardized=T, rsq=T)
## lavaan 0.6-11 ended normally after 60 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 83
##
## Used Total
## Number of observations 186 312
##
## Model Test User Model:
##
## Test statistic 28.094
## Degrees of freedom 22
## P-value (Chi-square) 0.173
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## chla_gr ~
## chla_1 -0.405 0.047 -8.687 0.000 -0.405 -0.540
## hcope_1 0.035 0.059 0.603 0.546 0.035 0.041
## amphi_m_1 0.027 0.045 0.600 0.548 0.027 0.036
## rotif_m_1 0.004 0.043 0.087 0.931 0.004 0.005
## corbic_1 -0.016 0.044 -0.352 0.725 -0.016 -0.022
## flow -0.016 0.047 -0.332 0.740 -0.016 -0.023
## turbid 0.028 0.044 0.630 0.529 0.028 0.041
## temp 0.044 0.043 1.019 0.308 0.044 0.066
## hcope_gr ~
## chla_1 -0.004 0.062 -0.070 0.944 -0.004 -0.004
## hcope_1 -0.799 0.101 -7.874 0.000 -0.799 -0.603
## pcope_1 -0.141 0.063 -2.256 0.024 -0.141 -0.140
## mysid_1 0.070 0.084 0.825 0.409 0.070 0.064
## corbic_1 0.156 0.057 2.709 0.007 0.156 0.143
## flow -0.388 0.072 -5.380 0.000 -0.388 -0.366
## turbid 0.122 0.069 1.760 0.078 0.122 0.116
## temp 0.019 0.065 0.291 0.771 0.019 0.018
## estfish_bsmt_1 -0.001 0.065 -0.022 0.983 -0.001 -0.001
## amphi_m_gr ~
## chla_1 0.065 0.072 0.894 0.371 0.065 0.058
## amphi_m_1 -0.503 0.070 -7.203 0.000 -0.503 -0.453
## flow 0.006 0.073 0.080 0.936 0.006 0.006
## turbid -0.060 0.068 -0.888 0.374 -0.060 -0.060
## temp -0.034 0.066 -0.513 0.608 -0.034 -0.034
## estfish_bsmt_1 -0.058 0.067 -0.872 0.383 -0.058 -0.061
## rotif_m_gr ~
## chla_1 -0.188 0.138 -1.357 0.175 -0.188 -0.076
## rotif_m_1 -1.439 0.128 -11.262 0.000 -1.439 -0.649
## flow 0.663 0.143 4.627 0.000 0.663 0.294
## turbid -0.147 0.133 -1.107 0.268 -0.147 -0.066
## temp -0.123 0.129 -0.960 0.337 -0.123 -0.056
## estfish_bsmt_1 -0.070 0.130 -0.539 0.590 -0.070 -0.033
## pcope_gr ~
## hcope_1 -0.053 0.169 -0.311 0.756 -0.053 -0.023
## pcope_1 -1.040 0.106 -9.795 0.000 -1.040 -0.603
## mysid_1 0.196 0.143 1.368 0.171 0.196 0.105
## corbic_1 0.069 0.102 0.676 0.499 0.069 0.037
## flow -0.271 0.121 -2.236 0.025 -0.271 -0.149
## turbid -0.293 0.116 -2.527 0.012 -0.293 -0.164
## temp 0.040 0.109 0.367 0.713 0.040 0.023
## estfish_bsmt_1 -0.180 0.110 -1.634 0.102 -0.180 -0.107
## chla_1 0.273 0.114 2.404 0.016 0.273 0.138
## mysid_gr ~
## hcope_1 0.094 0.306 0.307 0.759 0.094 0.023
## pcope_1 -0.182 0.193 -0.944 0.345 -0.182 -0.057
## mysid_1 -2.365 0.257 -9.189 0.000 -2.365 -0.692
## amphi_m_1 -0.309 0.182 -1.696 0.090 -0.309 -0.085
## flow -1.146 0.216 -5.309 0.000 -1.146 -0.344
## turbid 0.807 0.208 3.886 0.000 0.807 0.245
## temp 0.146 0.191 0.763 0.446 0.146 0.045
## estfish_bsmt_1 0.098 0.198 0.492 0.623 0.098 0.032
## estfish_bsmt_gr ~
## estfish_bsmt_1 -1.403 0.175 -8.001 0.000 -1.403 -0.572
## hcope_1 0.191 0.275 0.695 0.487 0.191 0.058
## pcope_1 -0.185 0.176 -1.055 0.291 -0.185 -0.074
## amphi_m_1 -0.067 0.183 -0.366 0.714 -0.067 -0.023
## rotif_m_1 0.083 0.175 0.474 0.635 0.083 0.032
## mysid_1 0.318 0.230 1.383 0.167 0.318 0.117
## flow -0.486 0.194 -2.510 0.012 -0.486 -0.184
## turbid 0.102 0.184 0.553 0.580 0.102 0.039
## temp -0.027 0.169 -0.162 0.871 -0.027 -0.011
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla_gr ~~
## .hcope_gr 0.111 0.037 3.013 0.003 0.111 0.227
## .amphi_m_gr 0.047 0.038 1.249 0.212 0.047 0.092
## .rotif_m_gr 0.069 0.073 0.943 0.346 0.069 0.069
## .pcope_gr -0.118 0.061 -1.935 0.053 -0.118 -0.143
## .mysid_gr 0.087 0.108 0.804 0.421 0.087 0.059
## .estfsh_bsmt_gr -0.112 0.095 -1.182 0.237 -0.112 -0.087
## .hcope_gr ~~
## .amphi_m_gr 0.044 0.056 0.783 0.434 0.044 0.057
## .rotif_m_gr -0.326 0.111 -2.925 0.003 -0.326 -0.220
## .pcope_gr 0.336 0.093 3.606 0.000 0.336 0.274
## .mysid_gr 1.055 0.178 5.928 0.000 1.055 0.483
## .estfsh_bsmt_gr -0.166 0.142 -1.167 0.243 -0.166 -0.086
## .amphi_m_gr ~~
## .rotif_m_gr -0.175 0.115 -1.531 0.126 -0.175 -0.113
## .pcope_gr -0.340 0.097 -3.489 0.000 -0.340 -0.265
## .mysid_gr 0.156 0.168 0.927 0.354 0.156 0.068
## .estfsh_bsmt_gr -0.212 0.149 -1.425 0.154 -0.212 -0.105
## .rotif_m_gr ~~
## .pcope_gr 0.140 0.183 0.766 0.443 0.140 0.056
## .mysid_gr -0.824 0.330 -2.496 0.013 -0.824 -0.186
## .estfsh_bsmt_gr 0.117 0.286 0.410 0.682 0.117 0.030
## .pcope_gr ~~
## .mysid_gr 0.903 0.276 3.265 0.001 0.903 0.247
## .estfsh_bsmt_gr 0.435 0.239 1.821 0.069 0.435 0.135
## .mysid_gr ~~
## .estfsh_bsmt_gr -0.069 0.421 -0.165 0.869 -0.069 -0.012
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla_gr 0.330 0.034 9.644 0.000 0.330 0.700
## .hcope_gr 0.733 0.076 9.644 0.000 0.733 0.652
## .amphi_m_gr 0.801 0.083 9.644 0.000 0.801 0.773
## .rotif_m_gr 3.006 0.312 9.644 0.000 3.006 0.593
## .pcope_gr 2.055 0.213 9.644 0.000 2.055 0.626
## .mysid_gr 6.521 0.676 9.644 0.000 6.521 0.589
## .estfsh_bsmt_gr 5.066 0.525 9.644 0.000 5.066 0.729
##
## R-Square:
## Estimate
## chla_gr 0.300
## hcope_gr 0.348
## amphi_m_gr 0.227
## rotif_m_gr 0.407
## pcope_gr 0.374
## mysid_gr 0.411
## estfsh_bsmt_gr 0.271
summary(modfitS, standardized=T, rsq=T)
## lavaan 0.6-11 ended normally after 41 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 81
##
## Used Total
## Number of observations 192 312
##
## Model Test User Model:
##
## Test statistic 23.144
## Degrees of freedom 24
## P-value (Chi-square) 0.511
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## chla_gr ~
## chla_1 -0.486 0.050 -9.676 0.000 -0.486 -0.599
## hcope_1 0.063 0.046 1.362 0.173 0.063 0.079
## clad_1 0.119 0.044 2.675 0.007 0.119 0.159
## rotif_m_1 -0.044 0.046 -0.956 0.339 -0.044 -0.055
## corbic_1 -0.015 0.045 -0.331 0.741 -0.015 -0.019
## flow -0.081 0.051 -1.570 0.116 -0.081 -0.098
## turbid 0.003 0.047 0.069 0.945 0.003 0.004
## temp 0.018 0.046 0.393 0.694 0.018 0.023
## hcope_gr ~
## chla_1 0.148 0.058 2.540 0.011 0.148 0.158
## hcope_1 -0.460 0.057 -8.048 0.000 -0.460 -0.495
## pcope_1 0.008 0.054 0.155 0.877 0.008 0.009
## corbic_1 0.099 0.055 1.789 0.074 0.099 0.107
## flow -0.119 0.062 -1.926 0.054 -0.119 -0.125
## turbid -0.086 0.058 -1.493 0.136 -0.086 -0.096
## temp 0.059 0.057 1.037 0.300 0.059 0.066
## estfish_bsmt_1 -0.136 0.056 -2.439 0.015 -0.136 -0.152
## clad_gr ~
## chla_1 0.216 0.083 2.600 0.009 0.216 0.174
## clad_1 -0.561 0.077 -7.252 0.000 -0.561 -0.488
## pcope_1 0.019 0.076 0.249 0.803 0.019 0.016
## flow 0.222 0.084 2.656 0.008 0.222 0.176
## turbid -0.099 0.079 -1.252 0.211 -0.099 -0.083
## temp 0.018 0.078 0.229 0.819 0.018 0.015
## estfish_bsmt_1 -0.107 0.075 -1.420 0.156 -0.107 -0.090
## amphi_m_gr ~
## chla_1 -0.041 0.095 -0.430 0.667 -0.041 -0.025
## amphi_m_1 -0.885 0.089 -9.913 0.000 -0.885 -0.594
## flow -0.075 0.100 -0.750 0.453 -0.075 -0.045
## turbid 0.198 0.096 2.068 0.039 0.198 0.127
## temp 0.082 0.093 0.881 0.378 0.082 0.053
## estfish_bsmt_1 0.061 0.094 0.646 0.519 0.061 0.039
## rotif_m_gr ~
## chla_1 -0.003 0.101 -0.031 0.975 -0.003 -0.002
## rotif_m_1 -1.058 0.096 -10.988 0.000 -1.058 -0.603
## flow 0.365 0.105 3.479 0.001 0.365 0.204
## turbid -0.089 0.098 -0.911 0.362 -0.089 -0.053
## temp -0.036 0.097 -0.372 0.710 -0.036 -0.022
## estfish_bsmt_1 0.171 0.096 1.780 0.075 0.171 0.103
## pcope_gr ~
## chla_1 0.373 0.100 3.717 0.000 0.373 0.230
## hcope_1 -0.115 0.098 -1.176 0.240 -0.115 -0.072
## clad_1 0.112 0.095 1.179 0.238 0.112 0.075
## pcope_1 -0.764 0.096 -8.001 0.000 -0.764 -0.493
## corbic_1 0.046 0.093 0.491 0.624 0.046 0.029
## flow 0.003 0.106 0.026 0.979 0.003 0.002
## turbid -0.091 0.098 -0.932 0.351 -0.091 -0.059
## temp -0.002 0.095 -0.018 0.986 -0.002 -0.001
## estfish_bsmt_1 -0.053 0.097 -0.553 0.580 -0.053 -0.035
## estfish_bsmt_gr ~
## estfish_bsmt_1 -1.434 0.174 -8.228 0.000 -1.434 -0.517
## hcope_1 0.010 0.175 0.059 0.953 0.010 0.004
## pcope_1 -0.204 0.175 -1.164 0.244 -0.204 -0.073
## amphi_m_1 0.230 0.158 1.454 0.146 0.230 0.087
## rotif_m_1 -0.015 0.173 -0.086 0.931 -0.015 -0.005
## clad_1 0.251 0.167 1.506 0.132 0.251 0.093
## flow -0.151 0.191 -0.790 0.430 -0.151 -0.051
## turbid 0.513 0.178 2.880 0.004 0.513 0.184
## temp -0.037 0.172 -0.217 0.828 -0.037 -0.013
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla_gr ~~
## .hcope_gr 0.126 0.036 3.460 0.001 0.126 0.258
## .clad_gr 0.198 0.050 3.951 0.000 0.198 0.298
## .amphi_m_gr 0.016 0.058 0.273 0.785 0.016 0.020
## .rotif_m_gr 0.184 0.062 2.956 0.003 0.184 0.218
## .pcope_gr -0.003 0.059 -0.046 0.963 -0.003 -0.003
## .estfsh_bsmt_gr -0.077 0.107 -0.724 0.469 -0.077 -0.052
## .hcope_gr ~~
## .clad_gr 0.182 0.060 3.033 0.002 0.182 0.224
## .amphi_m_gr 0.104 0.071 1.466 0.143 0.104 0.106
## .rotif_m_gr -0.188 0.075 -2.498 0.012 -0.188 -0.183
## .pcope_gr 0.093 0.072 1.293 0.196 0.093 0.094
## .estfsh_bsmt_gr -0.300 0.131 -2.285 0.022 -0.300 -0.167
## .clad_gr ~~
## .amphi_m_gr 0.067 0.097 0.686 0.492 0.067 0.050
## .rotif_m_gr 0.172 0.102 1.682 0.093 0.172 0.122
## .pcope_gr 0.071 0.099 0.716 0.474 0.071 0.052
## .estfsh_bsmt_gr -0.297 0.179 -1.660 0.097 -0.297 -0.121
## .amphi_m_gr ~~
## .rotif_m_gr -0.089 0.123 -0.727 0.467 -0.089 -0.053
## .pcope_gr -0.155 0.119 -1.298 0.194 -0.155 -0.094
## .estfsh_bsmt_gr -0.666 0.220 -3.033 0.002 -0.666 -0.224
## .rotif_m_gr ~~
## .pcope_gr 0.420 0.128 3.276 0.001 0.420 0.243
## .estfsh_bsmt_gr 0.438 0.227 1.935 0.053 0.438 0.141
## .pcope_gr ~~
## .estfsh_bsmt_gr 0.742 0.224 3.307 0.001 0.742 0.246
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla_gr 0.399 0.041 9.798 0.000 0.399 0.662
## .hcope_gr 0.593 0.061 9.798 0.000 0.593 0.736
## .clad_gr 1.113 0.114 9.798 0.000 1.113 0.783
## .amphi_m_gr 1.621 0.165 9.798 0.000 1.621 0.658
## .rotif_m_gr 1.775 0.181 9.798 0.000 1.775 0.625
## .pcope_gr 1.675 0.171 9.798 0.000 1.675 0.694
## .estfsh_bsmt_gr 5.441 0.555 9.798 0.000 5.441 0.694
##
## R-Square:
## Estimate
## chla_gr 0.338
## hcope_gr 0.264
## clad_gr 0.217
## amphi_m_gr 0.342
## rotif_m_gr 0.375
## pcope_gr 0.306
## estfsh_bsmt_gr 0.306
#modificationindices(modfitW, sort=T, maximum.number=20)
#residuals(modfitW)
labelsfarwest=createLabels(modfitFW, cnameslag)
labelswest=createLabels(modfitW, cnameslag)
labelsnorth=createLabels(modfitN, cnameslag)
labelssouth=createLabels(modfitS, cnameslag)
#FAR WEST
zoop_plot_far_west <- createGraph(fit=modfitFW,
reference_df=cnameslag,
model_type="monthly_zoop",
region="Far West",
title="Far West",
manual_port_settings=TRUE)
zoop_plot_far_west
#WEST
zoop_plot_west <- createGraph(fit=modfitW,
reference_df=cnameslag,
model_type="monthly_zoop",
region="West",
title="West",
manual_port_settings=TRUE)
zoop_plot_west
#NORTH
zoop_plot_north <- createGraph(fit=modfitN,
reference_df=cnameslag,
model_type="monthly_zoop",
region="North",
title="North",
manual_port_settings=TRUE)
zoop_plot_north
#SOUTH
zoop_plot_south <- createGraph(fit=modfitS,
reference_df=cnameslag,
model_type="monthly_zoop",
region="South",
title="South",
manual_port_settings=TRUE)
zoop_plot_south